Home > Backend Development > PHP Tutorial > 怎样通过curl把网络图片上传到服务器上?

怎样通过curl把网络图片上传到服务器上?

WBOY
Release: 2016-06-20 12:31:26
Original
1676 people have browsed it

把某个网站的图片上传到自己的服务器上,通过一个接口上传到自己的服务器,用curl上传


回复讨论(解决方案)

1、获取远程图片内容
2、保存获取的数据到临时文件
3、上传临时文件到服务器

1、获取远程图片内容
2、保存获取的数据到临时文件
3、上传临时文件到服务器


第一步会做,第二步怎么做呢?

手册上不是有例子吗?

$tmpfname = tempnam("/tmp", "FOO");$handle = fopen($tmpfname, "w");fwrite($handle, "writing to tempfile");fclose($handle);
Copy after login

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