php curl 下载图片到本地
程序员文章站
2022-04-27 09:49:35
...
[PHP]代码
<?php //获取空间头像图片 $url = "http://qlogo2.store.qq.com/qzone/393183837/393183837/50"; $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); //phper地带 http://www.php.cn/ ?>
推荐阅读