https://github.com/lovefc/taobaoapi
淘宝开放平台基础api
https://github.com/lovefc/taobaoapi
Last synced: 8 days ago
JSON representation
淘宝开放平台基础api
- Host: GitHub
- URL: https://github.com/lovefc/taobaoapi
- Owner: lovefc
- License: apache-2.0
- Created: 2020-08-17T02:09:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-30T08:16:05.000Z (almost 4 years ago)
- Last Synced: 2025-04-05T09:23:22.093Z (about 1 month ago)
- Language: PHP
- Size: 22.5 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 淘宝开放平台API类库
php封装的淘宝api类库,简单好用,配合文档食用,不用再去记函数名以及参数
### 安装
直接下载源码或者使用 composer 安装
````
{
"require": {
"lovefc/taobaoapi": "0.0.2"
}
}
````### 食用方法
````
$config = array(
'client_id' => 'xx', //client_id
'client_secret' => 'xxxx', //client_secret
'backurl' => 'xxxxxx', //回调地址
'data_type' => 'json', // 返回数据格式
'taobao_token_file' => __DIR__ .'/taobao_token.txt'
);// 必须要授权后使用
$taobao = new Taobao\Api($config);$datas = array(
// session的值如果提示要传,就要传,它本质上就是你授权获取的token
'session' => $taobao->access_token,
'simplify'=>'true',
'fields' => 'tid,orders,receiver_name,receiver_state,receiver_address,receiver_mobile,receiver_phone,shop_pick,buyer_nick,receiver_town,o2o_shop_name'
);// 这里使用的函数就是淘宝的api接口名
// 参考 https://open.taobao.com/api.htm?docId=46&docType=2
// 注意把api接口名中的点号换成下划线即可,传参请参考文档
$data = $taobao->taobao_trades_sold_get($datas);$data = json_decode($data, true);
print_r($data);
````
### 交流讨论
QQ群号:474310505
