Home > php教程 > PHP源码 > php curl 下载图片到本地

php curl 下载图片到本地

PHP中文网
Release: 2016-05-25 17:06:31
Original
1408 people have browsed it

[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/
?>
Copy after login

                   

                   

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template