Heim  >  Artikel  >  php教程  >  php版淘宝网查询商品接口代码

php版淘宝网查询商品接口代码

WBOY
WBOYOriginal
2016-05-25 16:45:431378Durchsuche

下面来给大家介绍一个php版淘宝网查询商品接口代码的例子,下面要(www.phprm.com)改成你的信息的在代码后面都有说明了,同时sdk包我们也要官方下载.

其实我也没做什么只是把标准事例改了下,请下载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 = "xx(www.phprm.com)xxxx"; //换成你的 
$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);


文章链接:

随便收藏,请保留本文地址!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn