curl 下载图片到本地

$url = "http://image.zujuan.com/ChangeToImg_parse.aspx?q=2889684&b=11&w=700";

$curl = curl_init($url);

$filename = date("Ymdhis").".jpg";

curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);

$imageData = curl_exec($curl);

curl_close($curl);

$tp = @fopen($filename, 'a');

fwrite($tp, $imageData);

fclose($tp);


你可能感兴趣的:(curl,下载图片)