search
Homephp教程php手册Thinkphp淘宝接口API开发

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)