Home >Backend Development >PHP Tutorial >透过商品ID获取api淘宝客链接不成功,空白

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

WBOY
WBOYOriginal
2016-06-13 11:05:561446browse

通过商品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文档.

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