Home > Backend Development > PHP Problem > How to access the download link and save the downloaded file in php

How to access the download link and save the downloaded file in php

王林
Release: 2023-02-28 17:38:01
Original
7584 people have browsed it

How to access the download link and save the downloaded file in php

Description:

#A download link on the Internet. When accessed in the browser, a picture will be downloaded. How to use it here? PHP script, access this link, and then save the downloaded image to the local specified folder?

Note: Use a script to access the link, and then save the file returned by the link. This has nothing to do with the browser.

Online learning video tutorial sharing: php video tutorial

##Picture link: https://clarks .scene7.com/is/image/clarks/download/26085012_A

Code example:

$s = file_get_contents('https://clarks.scene7.com/is/image/clarks/download/26085012_A');
$path = './a.jpeg';  //文件路径和文件名
file_put_contents($path, $s);
Copy after login

Related article tutorial recommendation:

php tutorial

The above is the detailed content of How to access the download link and save the downloaded file in php. For more information, please follow other related articles on the PHP Chinese website!

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