作者:apiaoapiao_622 | 来源:互联网 | 2017-05-13 02:17
$url = 'http://mf1905.com/upload/video_img/df3074c98ec5124ad47c52ff59f74e04_middle.jpeg?s=#39;;
function http_get_data($url) {
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_CUSTOMREQUEST, 'GET' );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $ch, CURLOPT_URL, $url );
ob_start ();
curl_exec ( $ch );
$return_cOntent= ob_get_contents ();
ob_end_clean ();
$return_code = curl_getinfo ( $ch, CURLINFO_HTTP_CODE );
return $return_content;
}
$return_cOntent= http_get_data($url);
$filename = 'test.jpg';
$fp= @fopen($filename,"a"); //将文件绑定到流 ??
fwrite($fp,$return_content); //写入文件
以上就介绍了php通过curl下载远程图片实例,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。