FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to read/to download attachment on an URI?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to read/to download attachment on an URI? [message #172585 is a reply to message #172565] Tue, 22 February 2011 01:33 Go to previous messageGo to previous message
n00m is currently offline  n00m
Messages: 25
Registered: February 2011
Karma:
Junior Member
Done.
===========================================

<?php

$url_1 = "http://stooq.com.ua/q/d/?s=wig20";
$url_2 = "http://stooq.com.ua/q/d/l/?s=wig20&i=d";


$headers = array(
'GET ' . $url_1 . ' HTTP/1.0',
'Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel, application/
msword, */*',
'Accept-Language: ru,zh-cn;q=0.7,zh;q=0.3',
'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1)',
'Proxy-Connection: Keep-Alive'
);


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_1);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, $url_2);
$headers[0] = 'GET ' . $url_2 . ' HTTP/1.0';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
$fp = fopen("ccc.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);


echo "\n\n\nDone!\n";
fgetc(STDIN);

?>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Cake PHP RAD Framework
Next Topic: 500. Turbo Sort
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 08:28:43 GMT 2024

Total time taken to generate the page: 0.04586 seconds