Home  >  Article  >  Backend Development  >  有会淘宝api的吗?求问如何直接上传网络图片

有会淘宝api的吗?求问如何直接上传网络图片

WBOY
WBOYOriginal
2016-06-23 14:10:291504browse

如题。求问如何直接上传网络图片.
比如:http://www.***.com/***.jpg

SDK如下:

$c = new TopClient;
$c->appkey = appkey;
$c->secretKey = secret;
$req = new ItemAddRequest;
$req->setNum(30);

****省略

//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setImage(@fileLocation);

****省略

$req->setPicPath("i7/T1rfxpXcVhXXXH9QcZ_033150.jpg");

****省略

$resp = $c->execute($req, $sessionKey);


回复讨论(解决方案)

这里的setPicPath是淘宝图片空间的相对地址,并不是可以直接传的网络图片地址。
setImage是上传本地文件的。

Statement:
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