淘宝接口基础调用方法-查询商品-php

来源:互联网 发布:到香港去网络要关闭吗 编辑:程序博客网 时间:2024/05/02 07:48

其实我也没做什么只是把标准事例改了下。

请下载SDK包解压后与该文件放在同一目录下。

<?php

header("Content-type: text/html; charset=utf-8");
include "TopSdk.php";
//将下载SDK解压后top里的TopClient.php第8行$gatewayUrl的值改为沙箱地址:http://gw.api.tbsandbox.com/router/rest,
//正式环境时需要将该地址设置为:http://gw.api.taobao.com/router/rest
 
//实例化TopClient类
$c = new TopClient;
$c->appkey = "xxxxxx"; //换成你的
$c->secretKey = "xxxxxxxx"; //换成你的
$sessionkey= "";   //如沙箱测试帐号sandbox_c_1授权后得到的sessionkey
//实例化具体API对应的Request类
$req = new ItemGetRequest();
$req->setFields("num_iid,title");
$req->setNumIid(23899912039);
//$req->setNick("sandbox_c_1");
 
//执行API请求并打印结果
$resp = $c->execute($req,"");
echo "result:";
print_r($resp);
?>
0 0
原创粉丝点击