Home > Backend Development > PHP Tutorial > The easiest way to download images via url in php.

The easiest way to download images via url in php.

WBOY
Release: 2016-07-29 09:02:51
Original
1587 people have browsed it
<?php
Copy after login
$url =&#39;http://mmbiz.qpic.cn/mmbiz/PGkxayImcuhpTfGWiagtAY1R8L7C1licueqssxnJSJJntscaUrK6vAiakqo4RXdv2bud2ic3YicVbvIghLFhGc5ByyA/0&#39;;
 file_put_contents(&#39;aaa.jpg&#39;, file_get_contents($url));
Copy after login
?>
Copy after login

If you want to download to the specified /www/uplods path, just replace aaa.jpg with /www/uploads/aaa.jpg

The premise is that the directory is writable, you can use chmod 755 /www/uploads

The above introduces the simplest method in PHP to download images through URL. , including relevant content, I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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