最新消息:红方科技年末特惠:.com域名55元、云虚机五折优惠,买3年送2年,更有智能建站套餐等你来取!

PHP远程下载采集图片

Linux yinhexi 821浏览 0评论

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, ‘图片url’);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_TIMEOUT, 10);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);

$content = curl_exec($ch);

curl_close($ch);

file_put_contents(‘图片本地保存路径+图片名’, $content);

转载请注明:红方博客 » PHP远程下载采集图片