CURL

1.download a large file

reference: http://stackoverflow.com/questions/6409462/downloa...

<?php
set_time_limit(0);
$fp = fopen (dirname(__FILE__) . '/localfile.tmp', 'w+');//This is the file where we save the    information
$ch = curl_init(str_replace(" ","%20",$url));//Here is the file we are downloading, replace spaces with %20
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp); // write curl response to file
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch); // get curl response
curl_close($ch);
fclose($fp);
?>

2.upload a large file

(1) reference: http://stackoverflow.com/questions/15968972/is-it-...

(2) reference: http://stackoverflow.com/questions/1134313/how-can...

(3) reference: http://zingaburga.com/2011/02/streaming-post-data-...

arrow
arrow
    全站熱搜

    Ping 發表在 痞客邦 留言(0) 人氣()