根据关键字查询商品列表,支持指定排序字段
1、注册订单侠开放平台账号
注册地址: https://www.dingdanxia.com/user/register/index.html
2、获取接口秘钥apikey
登录个人中心 - 系统设置 - 接口管理 找到接秘钥apikey,apikey 接口秘钥是调用接口的唯一凭证,请妥善保管!
3、授权唯品会账号
登录个人中心 - 授权管理 - 唯品会授权, 授权自己的唯品会账号。
4、PHP代码调用示例
<?php
// +----------------------------------------------------------------------
// | 订单侠开放平台 www.dingdanxia.com [ 专为淘客开发者提供一站式API解决方案 ]
// +----------------------------------------------------------------------
//接口秘钥
$apikey = '这里填写你的apikey';
//唯品会关键词商品查询接口
$apiurl = "http://api.tbk.dingdanxia.com/vip/query";
//开始调用
$result = curl_post($apiurl, array(
//接口秘钥
"apikey" => $apikey,
"keyword" =>"女装"
));
//打印结果
print_r($result);
/**
* post请求
* @param string $url
* @param array $params
* @param int $timeout
*/
function curl_post($url, $params, $timeout = 3) {
try {
foreach ($params as $key => $val) {
$post[] = "{$key}={$val}";
}
$post_data = implode('&', $post);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
return curl_exec($ch);
}
catch (Exception $e) {
return false;
}
}
5、接口返回结果
{
"code":200,
"msg":"请求成功【success】",
"total_results":493681,
"data":[
{
"marketPrice":"129.00",
"commissionRate":"8",
"goodsId":"6918778164888168919",
"discount":"0.30",
"categoryName":"女式T恤",
"cat2ndName":"女上装",
"cat1stName":"女装",
"vipPrice":"39.00",
"commission":"3.12",
"cat1stId":311,
"goodsName":"夏季新品潮流时尚韩版女款休闲印花短袖T恤",
"brandName":"真维斯",
"brandLogoFull":"http://a.vpimg3.com/upload/brandcool/0/002f58a14cf34d29957beb9ae246c9ed/10011476/primary.png",
"brandStoreSn":"10011476",
"sellTimeFrom":1537847365000,
"schemeStartTime":1590027839000,
"schemeEndTime":2145888000000,
"sourceType":0,
"sellTimeTo":1735660800000,
"brandId":1710613335,
"goodsThumbUrl":"https://a.vpimg3.com/upload/merchandise/pdcvis/2020/05/11/63/13207a17-7a46-45af-b107-149a8920600f_750x750_50.jpg",
"cat2ndId":312,
"storeInfo":{
"storeName":"唯品自营",
"storeId":"ST00000"
},
"goodsMainPicture":"https://a.vpimg2.com/upload/merchandise/pdcvis/2020/05/11/63/13207a17-7a46-45af-b107-149a8920600f.jpg",
"destUrl":"https://m.vip.com/product-1710613335-6918778164888168919.html",
"categoryId":314,
"status":1
}
]
}