利用curl来下载

据说利用curl下载效率高.当然使用前提是在php,ini中打开curl这个拓展.


function curl_download($remote, $local) {
$cp = curl_init($remote);
$fp = fopen($local, "w");

curl_setopt($cp, CURLOPT_FILE, $fp);
curl_setopt($cp, CURLOPT_HEADER, 0);

curl_exec($cp);
curl_close($cp);
fclose($fp);

}
/*-----------USEAGE----------------
curl_download("http://www.zhaomingliang.com/wp-content/uploads/2007/05/girl1.jpg","Girl.jpg");
-----------USEAGE----------------*/

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>