首页 >后端开发 >php教程 > 透过商品ID获取api淘宝客链接不成功,空白

透过商品ID获取api淘宝客链接不成功,空白

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-13 12:58:29873浏览

通过商品ID获取api淘宝客链接不成功,空白

访问这个文件 url.php?goods=14535976817 通过商品id获取对应淘宝客链接,空白,好像没获取数据<br />
<br />
<?php<br />
require_once('lib/taobao/TopSdk.php');<br />
$pid = pid;<br />
$c = new TopClient;<br />
$c->appkey = "appkey";<br />
$c->secretKey = "secretKey";<br />
if(isset($_GET['goods']) && is_numeric($_GET['goods']))<br />
{<br />
    $req = new TaobaokeItemsConvertRequest;<br />
    $req->setFields("click_url,num_iid");<br />
    $req->setPid($pid);<br />
    $req->setNumIids($_GET['goods']);<br />
    $resp = $c->execute($req);<br />
    if(isset($resp->taobaoke_items->taobaoke_item->click_url))<br />
    {<br />
        $url = $resp->taobaoke_items->taobaoke_item->click_url;<br />
    }<br />
}<br />
if(!empty($url))<br />
{<br />
?><br />
<script type="text/javascript"><br />
location.href='<?php echo $url;?>';<br />
</script><br />
<?php<br />
}

------解决方案--------------------
ItemsConvert api已经切换成组件调用模式 具体的查官方的api文档.

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn