Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

API技术讲解

2,579 views

Published on

Published in: Technology
  • Be the first to comment

API技术讲解

  1. 1. 淘宝开放平台 童虎 @技术支持
  2. 2. 介绍内容 一:淘宝API可以做什么 二:API调用机制 三:ISV接入流程 四:TOP常用环境对比 五:典型营销例子解析
  3. 3. 一:淘宝API可以做什么
  4. 4. 二:API调用机制
  5. 5. 三:ISV接入流程
  6. 6. 四:TOP常用环境对比
  7. 7. 五:典型营销例子解析 场景:获取客户的个人信息以 方便后续营销
  8. 8. PHP代码示例<?php //设置你的APPKEY和secret $appKey = 'test'; $appSecret = 'test'; //参数数组 $paramArr = array( 'app_key' => $appKey, 'method' => 'taobao.trades.sold.get', 'format' => 'json', 'v' => '2.0', 'sign_method' => 'md5', 'timestamp' => date('Y-m-d H:i:s'), 'fields' => 'receiver_name,receiver_mobile,receiver_phone' );
  9. 9. PHP代码示例 //生成签名 $sign = $appSecret; ksort($paramArr); foreach ($paramArr as $key => $val) { if ($key !='' && $val !='') { $sign .= $key.$val; } } $sign.=$appSecret; $sign = strtoupper(md5($sign)); //组织参数 $strParam = ''; foreach ($paramArr as $key => $val) { if ($key != '' && $val !='') { $strParam .= $key.'='.urlencode($val).'&'; } } $strParam .= 'sign='.$sign;
  10. 10. PHP代码示例 //访问服务 $url = 'http://gw.api.taobao.com/router/rest?'.$strParam; $result = file_get_contents($url); //解析JSON $result = json_decode($result); //获取手机号码 echo "你的手机号码为:".$result- >trades_sold_get_response->trades->trade- >receiver_mobile; } ?>
  11. 11. top技术支持为你提供标准化的服务, 你的满意就是我们的目标!!! 童虎 Email:tonghu@taobao.com

×