Home > Backend Development > PHP Tutorial > PHP下载图片函数

PHP下载图片函数

WBOY
Release: 2016-06-20 13:03:33
Original
1228 people have browsed it

function imagefromURL($image,$rename)<br />{<br />$ch = curl_init($image);<br />curl_setopt($ch, CURLOPT_HEADER, 0);<br />curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);<br />$rawdata=curl_exec ($ch);<br />curl_close ($ch);<br />$fp = fopen("$rename",'w');<br />fwrite($fp, $rawdata); <br />fclose($fp);<br /><p>}</p><p>
Copy after login

语法:

<p><?php</p><p>$url = "http://www.scutephp.com/images/logo.png";</p><p>$rename = "logo.png";</p><p>imagefromURL($url,$rename);</p><p>?></p><p>
Copy after login

其他PHP图片下载函数

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template