Home >php教程 >php手册 >Thinkphp淘宝接口API开发

Thinkphp淘宝接口API开发

WBOY
WBOYOriginal
2016-06-07 11:35:192706browse

Thinkphp淘宝接口API开发
访问案例:http://taobao.flc.ren/
源码地址:https://github.com/flc1125/taobao-open-api

如任何疑问,请再此留言:http://flc.ren/2016/03/491.html

本次开发接口如下:
接口名称 官方接口名称
获取前台展示的店铺内卖家自定义商品类目 taobao.sellercats.list.get
获取前台展示的店铺类目 taobao.shopcats.list.get
获取卖家店铺的基本信息 taobao.shop.get
淘宝客商品查询 taobao.tbk.item.get
淘宝客商品详情(简版) taobao.tbk.item.info.get
淘宝客商品关联推荐查询 taobao.tbk.item.recommend.get
淘宝客店铺查询 taobao.tbk.shop.get
淘宝客店铺关联推荐查询 taobao.tbk.shop.recommend.get

访问案例首页主要使用taobao.tbk.item.get

文件及配置说明:
存放目录:将下载的/Taobao/整个文件夹放入/ThinkPHP/Library/Com/目录下;其中Thinkphp为官方核心目录
配置文件所在目录:/ThinkPHP/Library/Com/Taobao/Client.class.php的appkey及appsecret

实例代码:<?php <br /> /**<br>  * 淘宝API接口范例<br>  *<br>  * @author Flc <br>  * @link http://flc.ren <br>  */<br> namespace Home\Controller;<br> <br> use Think\Controller;<br> use Com\Taobao\Client;<br> use Com\Taobao\Request\TaobaoTbkItemGet;  // 淘宝客商品查询<br> use Com\Taobao\Request\TaobaoTbkItemRecommendGet; // 淘宝客商品关联推荐查询<br> use Com\Taobao\Request\TaobaoTbkItemInfoGet; // 淘宝客商品详情(简版)<br> use Com\Taobao\Request\TaobaoTbkShopGet; // 淘宝客店铺查询<br> use Com\Taobao\Request\TaobaoTbkShopRecommendGet; // 淘宝客店铺关联推荐查询<br> use Com\Taobao\Request\TaobaoShopcatsListGet; // 获取前台展示的店铺类目<br> use Com\Taobao\Request\TaobaoSellercatsListGet; // 获取前台展示的店铺内卖家自定义商品类目<br> use Com\Taobao\Request\TaobaoShopGet; // 获取前台展示的店铺内卖家自定义商品类目<br> <br> class IndexController extends Controller {<br> <br>     /**<br>      * DEMO<br>      * @return [type] [description]<br>      */<br>     public function index()<br>     {<br>         $req = (new TaobaoTbkItemGet)<br>             ->setFields('num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick')<br>             ->setQ("女装")<br>             ->setCat("16,18")<br>             ->setSort("_des");<br>         /*$req = (new TaobaoTbkItemRecommendGet)<br>             ->setFields('num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick')<br>             ->setRelateType(1)<br>             ->setCount(5)<br>             ->setNumIid("6956495372");*/<br>         /*$req = (new TaobaoTbkItemInfoGet)<br>             ->setFields('num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick')<br>             ->setNumIids("6956495372");*/<br>         /*$req = (new TaobaoTbkShopGet)<br>             ->setFields('user_id,shop_title,shop_type,seller_nick,pict_url,shop_url')<br>             ->setQ("女装")<br>             ->setSort("_des");*/<br>         /*$req = (new TaobaoTbkShopRecommendGet)<br>             ->setFields('user_id,shop_title,shop_type,seller_nick,pict_url,shop_url')<br>             ->setUserId("663336865");*/<br>         /*$req = (new TaobaoShopcatsListGet)->setFields('cid,parent_cid,name,is_parent');*/<br>         /*$req = (new TaobaoSellercatsListGet)->setNick('jw原单服饰店');*/<br>         /*$req = (new TaobaoShopGet)<br>             ->setNick('jw原单服饰店')<br>             ->setFields('sid,cid,title,nick,desc,bulletin,pic_path,created,modified');*/<br> <br>         $rs = (new Client)->execute($req);<br>         print_r($rs);<br>     }<br> }<br> ?>其他说明:
目前仅开发以上接口,其他接口暂时无权限;如需拓展,请在/ThinkPHP/Library/Com/Taobao/Request/下新增类

AD:真正免费,域名+虚机+企业邮箱=0元

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