淘宝、京东联盟数字ID转加密ID接口

该接口可以将主站的数字ID转换为加密ID

例如:123456789 转换为 xxxxxxxxxx-xxxxxxxxx

PHP示例

// 接口地址:https://www.haodanku.com/openapi/api_detail?id=103
$app_secret = '你的appSecret', //替换成自己的
$x = [
	 'app_id' => '你的appid',  //替换成自己的
	 'date'=> date('Y-m-d H:i:s')
     'method'  => 'analyze.clipboard',
     'content' => 'https://detail.tmall.com/item.htm?id=848373929483', //填写商品链接
     'is_change'  => '0',
];
ksort($x);

$url = '';
$curl = "curl -X POST 'http://v3.api.haodanku.com/rest' \\ <br />"
. "-H 'Content-type:application/json;charset=utf-8;charset=utf-8' \\ <br />";
$stringToBeSigned = '';
foreach($x as $k=>$v)
{
    if (!is_array($v) && "@" != substr($v, 0, 1))
    {
        $stringToBeSigned .= "$k$v";
    }
}

$sign = strtoupper(md5($stringToBeSigned . $app_secret));
$x['sign'] = $sign;
$curl .= "-d '".json_encode($x,JSON_UNESCAPED_UNICODE)."'";
$end_param = json_encode($x);

//请求v3接口
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://v3.api.haodanku.com/rest');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $end_param);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);

请求结果

{
    "code": 200,
    "msg": "SUCCESS",
    "data": {
        "item_id": "xxxxxxxxx-xxxxxxxxxx", //最终返回的加密ID
        "itemid": "xxxxxxxxx-xxxxxxxxx", //最终返回的加密ID
        "click_url": "https://uland.taobao.com/quan/detail?sellerId=153192917143606425&activityId=fe7c2fab534b4xxxxx78c30b6a57",
        "item_url": "https://uland.taobao.com/item/edetail?id=xxxxxxxxx-xxxxxxxxx",
        "item_title": "金典纯牛奶250ml*12盒整箱官方纯牛奶儿童全脂高钙奶正品",
        "item_price": "68.00",
        "item_end_price": "29.90",
        "coupon_money": "1.00",
        "rates": "10.40",
        "item_pic": "https://img.alicdn.com/bao/uploaded/i1/2207820414138/O1CN01p6VGTg1gRFvP5PLEV_!!2-item_pic.png",
        "month_sale": "23",
        "shop_name": "金典旗舰店",
        "coupon_start_time": "1736956800",
        "coupon_end_time": "1737129599",
        "coupon_info": "单笔满68.0元可用",
        "min_buy": "单笔满68.0元可用",
        "images": "https://img.alicdn.com/i3/2207820414138/O1CN01WntEX01gRFkcNh9vo_!!2207820414138.jpg,https://img.alicdn.com/i3/2207820414138/O1CN015iJzcm1gRFikopJbW_!!2207820414138.jpg,https://img.alicdn.com/i3/2207820414138/O1CN01zUx4kr1gRFkLLuZYW_!!2207820414138.jpg,https://img.alicdn.com/i1/2207820414138/O1CN01M8U6gS1gRFvO48wWW_!!2207820414138.jpg,https://img.alicdn.com/bao/uploaded/i1/2207820414138/O1CN01p6VGTg1gRFvP5PLEV_!!2-item_pic.png",
        "plat_type": 1
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CBDLL

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值