Blogger Information
Blog 60
fans 0
comment 0
visits 100912
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP全国快递寄件接口,1天接入四通一达,极兔,宅急送,德邦,京东,天天
快递100API
Original
686 people have browsed it

快递100php快递寄件接口-一次性接入顺丰、京东、申通、圆通、韵达、中通、天天、百世、邮政、EMS等主流快递公司,只需要复制源码,并将部分参数修改为您的账户参数即可。

此php接口demo目录内容包括:快递公司的快递寄件接口,查询全国快递公司运力覆盖情况接口,取消寄快递命令接口。php快递查询接口示例仅用于展示快递100快递公司的快递寄件接口对接流程,其中的API密钥需要注册获取,您可点击访问https://api.kuaidi100.com接申请免费接口,如果需要人工帮助,可以咨询快递100API技术人员,此服务不收取任何费用。

  1. <?php
  2. //====================================
  3. // 商家寄件获取运力示例代码
  4. // 授权信息可通过链接查看:https://api.kuaidi100.com/manager/page/myinfo/enterprise
  5. //====================================
  6. //参数设置
  7. $key = ''; //客户授权key
  8. $secret = ''; //客户授权secret
  9. $param = array (
  10. 'sendAddr' => '广东省深圳市南山区软件产业基地4栋C座10G' //寄件人所在的完整地址,可通过:https://api.kuaidi100.com/product/expressprice 查找运力覆盖范围
  11. );
  12. $param_str = json_encode($param, JSON_UNESCAPED_UNICODE);
  13. list($msec, $sec) = explode(' ', microtime());
  14. $t = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); //当前时间戳
  15. $sign = strtoupper(md5($param_str.$t.$key.$secret));
  16. //请求参数
  17. $post_data = array();
  18. $post_data["method"] = 'querymkt';
  19. $post_data["key"] = $key;
  20. $post_data["t"] = $t;
  21. $post_data["sign"] = $sign;
  22. $post_data["param"] = $param_str;
  23. $url = 'http://order.kuaidi100.com/order/borderbestapi.do'; //商家寄件
  24. echo '<br/>请求参数<br/>';
  25. foreach ($post_data as $k=>$v) {
  26. echo "<br/>$k=".$v;
  27. }
  28. //发送post请求
  29. $ch = curl_init();
  30. curl_setopt($ch, CURLOPT_POST, 1);
  31. curl_setopt($ch, CURLOPT_HEADER, 0);
  32. curl_setopt($ch, CURLOPT_URL, $url);
  33. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
  34. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  35. $result = curl_exec($ch);
  36. $data = json_decode($result);
  37. echo '<br/><br/>返回数据<br/>';
  38. echo var_dump($data);
  39. ?>
  1. <?php
  2. //====================================
  3. // 商家寄件下单接口
  4. // 授权信息可通过链接查看:https://api.kuaidi100.com/manager/page/myinfo/enterprise
  5. //====================================
  6. //参数设置
  7. $key = ''; //客户授权key
  8. $secret = ''; //客户授权secret
  9. $param = array (
  10. 'kuaidicom' => '', //快递公司的编码
  11. 'recManName' => '', //收件人姓名
  12. 'recManMobile' => '', //收件人手机号
  13. 'recManPrintAddr' => '', //收件人所在完整地址
  14. 'sendManName' => '', //寄件人姓名
  15. 'sendManMobile' => '', //寄件人的手机号
  16. 'sendManPrintAddr' => '', //寄件人所在的完整地址
  17. 'callBackUrl' => '', //callBackUrl订单信息回调
  18. 'cargo' => '', //物品名称
  19. 'weight' => '1', //物品总重量KG
  20. 'serviceType' => '标准快递', //快递业务服务类型
  21. 'remark' => '', //备注
  22. 'salt' => '' //签名用随机字符串
  23. );
  24. $param_str = json_encode($param, JSON_UNESCAPED_UNICODE);
  25. list($msec, $sec) = explode(' ', microtime());
  26. $t = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); //当前时间戳
  27. $sign = strtoupper(md5($param_str.$t.$key.$secret));
  28. //请求参数
  29. $post_data = array();
  30. $post_data["method"] = 'bOrderBest';
  31. $post_data["key"] = $key;
  32. $post_data["t"] = $t;
  33. $post_data["sign"] = $sign;
  34. $post_data["param"] = $param_str;
  35. $url = 'http://order.kuaidi100.com/order/borderbestapi.do'; //商家寄件
  36. echo '<br/>请求参数<br/>';
  37. foreach ($post_data as $k=>$v) {
  38. echo "<br/>$k=".$v;
  39. }
  40. //发送post请求
  41. $ch = curl_init();
  42. curl_setopt($ch, CURLOPT_POST, 1);
  43. curl_setopt($ch, CURLOPT_HEADER, 0);
  44. curl_setopt($ch, CURLOPT_URL, $url);
  45. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
  46. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  47. $result = curl_exec($ch);
  48. $data = json_decode($result);
  49. echo '<br/><br/>返回数据<br/>';
  50. echo var_dump($data);
  51. ?>
  1. <?php
  2. //====================================
  3. // 商家寄件获取取件码
  4. // 授权信息可通过链接查看:https://api.kuaidi100.com/manager/page/myinfo/enterprise
  5. //====================================
  6. //参数设置
  7. $key = ''; //客户授权key
  8. $secret = ''; //客户授权secret
  9. $param = array (
  10. 'taskId' => '', //任务ID
  11. 'orderId' => '' //订单ID
  12. );
  13. $param_str = json_encode($param, JSON_UNESCAPED_UNICODE);
  14. list($msec, $sec) = explode(' ', microtime());
  15. $t = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); //当前时间戳
  16. $sign = strtoupper(md5($param_str.$t.$key.$secret));
  17. //请求参数
  18. $post_data = array();
  19. $post_data["method"] = 'getCode';
  20. $post_data["key"] = $key;
  21. $post_data["t"] = $t;
  22. $post_data["sign"] = $sign;
  23. $post_data["param"] = $param_str;
  24. $url = 'http://order.kuaidi100.com/order/borderbestapi.do'; //商家寄件
  25. echo '<br/>请求参数<br/>';
  26. foreach ($post_data as $k=>$v) {
  27. echo "<br/>$k=".$v;
  28. }
  29. //发送post请求
  30. $ch = curl_init();
  31. curl_setopt($ch, CURLOPT_POST, 1);
  32. curl_setopt($ch, CURLOPT_HEADER, 0);
  33. curl_setopt($ch, CURLOPT_URL, $url);
  34. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
  35. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  36. $result = curl_exec($ch);
  37. $data = json_decode($result);
  38. echo '<br/><br/>返回数据<br/>';
  39. echo var_dump($data);
  40. ?>
  1. <?php
  2. //====================================
  3. // 商家寄件取消接口
  4. // 授权信息可通过链接查看:https://api.kuaidi100.com/manager/page/myinfo/enterprise
  5. //====================================
  6. //参数设置
  7. $key = ''; //客户授权key
  8. $secret = ''; //客户授权secret
  9. $param = array (
  10. 'taskId' => '', //任务ID
  11. 'orderId' => '', //订单ID
  12. 'cancelMsg' => '' //取消原因
  13. );
  14. $param_str = json_encode($param, JSON_UNESCAPED_UNICODE);
  15. list($msec, $sec) = explode(' ', microtime());
  16. $t = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); //当前时间戳
  17. $sign = strtoupper(md5($param_str.$t.$key.$secret));
  18. //请求参数
  19. $post_data = array();
  20. $post_data["method"] = 'cancelBest';
  21. $post_data["key"] = $key;
  22. $post_data["t"] = $t;
  23. $post_data["sign"] = $sign;
  24. $post_data["param"] = $param_str;
  25. $url = 'http://order.kuaidi100.com/order/borderbestapi.do'; //商家寄件
  26. echo '<br/>请求参数<br/>';
  27. foreach ($post_data as $k=>$v) {
  28. echo "<br/>$k=".$v;
  29. }
  30. //发送post请求
  31. $ch = curl_init();
  32. curl_setopt($ch, CURLOPT_POST, 1);
  33. curl_setopt($ch, CURLOPT_HEADER, 0);
  34. curl_setopt($ch, CURLOPT_URL, $url);
  35. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
  36. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  37. $result = curl_exec($ch);
  38. $data = json_decode($result);
  39. echo '<br/><br/>返回数据<br/>';
  40. echo var_dump($data);
  41. ?>

商家寄件API支持快递公司说明

支持的快递公司:
1、商家寄件(优选快递)支持中通、圆通、百世、天天、韵达、极兔、宅急送等快递公司的寄件下单。
2、商家寄件(官方快递)支持德邦、京东、圆通和申通。
运力及运费区别:
1、 优选快递:不保证寄件地址的运力,根据寄件地址的不同,支持的快递公司会有变化;阶梯运费价格,在对接接口前请查看寄件运力及寄件价格: https://api.kuaidi100.com/product/expressprice/
2、官方快递:可以保证全国地址的运力。运费是官方寄件价格的折扣价,具体运费价格请咨询在线客服或者右侧扫码咨询客户经理。

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post