当前位置: 首页 > article >正文

淘宝、京东联盟数字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
    }
}

http://www.kler.cn/a/508442.html

相关文章:

  • 统信V20 1070e X86系统编译安装PostgreSQL-13.11版本以及主从构建
  • [Qt]常用控件介绍-多元素控件-QListWidget、QTableWidget、QQTreeWidget
  • 生成树机制实验
  • C++ 强化记忆
  • ZooKeeper 核心概念与机制深度解析
  • 【机器学习实战入门】使用 Pandas 和 OpenCV 进行颜色检测
  • CentOS 安装Redis
  • 机器学习之SVD奇异值分解实现图片降维
  • MySQL 数据库 :SQL 语句规约(不得使用外键与级联,一切外键概念必须在应用层解决。)
  • 无人机技术架构剖析!
  • 半导体、芯片、人工智能、智能驾驶汽车的趋势
  • ansible基础
  • 【OpenCV(C++)快速入门】--opencv学习
  • LTX-Video 高效视频生成模型,一键处理图片文字
  • Swift语言的软件开发工具
  • [SUCTF2018]babyre
  • 基于SpringBoot+Vue的药品管理系统【源码+文档+部署讲解】
  • 记一次linux下的c++ arm程序调试
  • c语言中单引号和双引号用法详解
  • cmake foreach 条件判断
  • SpringBoot Starter 通用接口加密组件(防篡改)+ RequestBodyAdvice和ResponseBodyAdvice原理
  • 商用车电子电气零部件电磁兼容条件和试验(8)—辐射抗干扰(ALSE)和便携式发射机抗干扰(HPT)
  • (01)STM32—GPIO
  • Django MySQL数据库配置完全指南
  • pytorch张量复制方法介绍
  • 自动化之Ansible