Blogger Information
Blog 60
fans 0
comment 0
visits 100915
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php快递查询接口,一次接入顺丰、京东、申通、圆通、韵达、中通、天天、百世、邮政、EMS等主流快递公司
快递100API
Original
803 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. $customer = ''; //查询公司编号
  9. $param = array (
  10. 'com' => 'yunda', //快递公司编码
  11. 'num' => '3950055201640', //快递单号
  12. 'phone' => '', //手机号
  13. 'from' => '', //出发地城市
  14. 'to' => '', //目的地城市
  15. 'resultv2' => '1' //开启行政区域解析
  16. );
  17. //请求参数
  18. $post_data = array();
  19. $post_data["customer"] = $customer;
  20. $post_data["param"] = json_encode($param);
  21. $sign = md5($post_data["param"].$key.$post_data["customer"]);
  22. $post_data["sign"] = strtoupper($sign);
  23. $url = 'http://poll.kuaidi100.com/poll/query.do'; //实时查询请求地址
  24. $params = "";
  25. foreach ($post_data as $k=>$v) {
  26. $params .= "$k=".urlencode($v)."&"; //默认UTF-8编码格式
  27. }
  28. $post_data = substr($params, 0, -1);
  29. echo '请求参数<br/>'.$post_data;
  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, $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. ?>
  1. <?php
  2. //====================================
  3. // 快递状态更新订阅请求示例代码
  4. // 授权信息可通过链接查看:https://api.kuaidi100.com/manager/page/myinfo/enterprise
  5. //====================================
  6. //参数设置
  7. $key = ''; //客户授权key
  8. $param = array (
  9. 'company' => 'yunda', //快递公司编码
  10. 'number' => '3950055201640', //快递单号
  11. 'from' => '', //出发地城市
  12. 'to' => '', //目的地城市
  13. 'key' => $key, //客户授权key
  14. 'parameters' => array (
  15. 'callbackurl' => '', //回调地址
  16. 'salt' => '', //加密串
  17. 'resultv2' => '1', //行政区域解析
  18. 'autoCom' => '0', //单号智能识别
  19. 'interCom' => '0', //开启国际版
  20. 'departureCountry' => '', //出发国
  21. 'departureCom' => '', //出发国快递公司编码
  22. 'destinationCountry' => '', //目的国
  23. 'destinationCom' => '', //目的国快递公司编码
  24. 'phone' => '' //手机号
  25. )
  26. );
  27. //请求参数
  28. $post_data = array();
  29. $post_data["schema"] = 'json';
  30. $post_data["param"] = json_encode($param);
  31. $url = 'http://poll.kuaidi100.com/poll'; //订阅请求地址
  32. $params = "";
  33. foreach ($post_data as $k=>$v) {
  34. $params .= "$k=".urlencode($v)."&"; //默认UTF-8编码格式
  35. }
  36. $post_data = substr($params, 0, -1);
  37. echo '请求参数<br/>'.$post_data;
  38. //发送post请求
  39. $ch = curl_init();
  40. curl_setopt($ch, CURLOPT_POST, 1);
  41. curl_setopt($ch, CURLOPT_HEADER, 0);
  42. curl_setopt($ch, CURLOPT_URL, $url);
  43. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  44. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  45. $result = curl_exec($ch);
  46. $data = json_decode($result);
  47. echo '<br/><br/>返回数据<br/>';
  48. echo var_dump($data);
  49. ?>
  1. <?php
  2. //====================================
  3. // 智能判断示例代码
  4. // 授权信息可通过链接查看:https://api.kuaidi100.com/manager/page/myinfo/enterprise
  5. //====================================
  6. //参数设置
  7. $key = ''; //客户授权key
  8. $num = '3950055201640'; //单号
  9. //请求参数
  10. $post_data = array();
  11. $post_data["key"] = $key;
  12. $post_data["num"] = $num;
  13. $url = 'http://www.kuaidi100.com/autonumber/auto'; //智能判断请求地址
  14. $params = "";
  15. foreach ($post_data as $k=>$v) {
  16. $params .= "$k=".urlencode($v)."&"; //默认UTF-8编码格式
  17. }
  18. $post_data = substr($params, 0, -1);
  19. echo '请求参数<br/>'.$post_data;
  20. //发送post请求
  21. $ch = curl_init();
  22. curl_setopt($ch, CURLOPT_POST, 1);
  23. curl_setopt($ch, CURLOPT_HEADER, 0);
  24. curl_setopt($ch, CURLOPT_URL, $url);
  25. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  26. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  27. $result = curl_exec($ch);
  28. $data = json_decode($result);
  29. echo '<br/><br/>返回数据<br/>';
  30. echo var_dump($data);
  31. ?>
  1. <?php
  2. //====================================
  3. // 地图轨迹示例代码
  4. // 授权信息可通过链接查看:https://api.kuaidi100.com/manager/page/myinfo/enterprise
  5. //====================================
  6. //参数设置
  7. $key = ''; //客户授权key
  8. $customer = ''; //查询公司编号
  9. $param = array (
  10. 'com' => 'yunda', //快递公司编码
  11. 'num' => '3950055201640', //快递单号
  12. 'phone' => '', //手机号
  13. 'from' => '', //出发地信息
  14. 'to' => '', //目的地信息
  15. 'show' => '0', //返回格式:0:json格式(默认),1:xml,2:html,3:text
  16. 'order' => 'desc', //返回结果排序:desc降序(默认),asc 升序
  17. 'orderTime' => '' //订单下单时间,格式为(yyyy-MM-dd HH:mm:ss)如:2020-12-16 12:59:59
  18. );
  19. //请求参数
  20. $post_data = array();
  21. $post_data["customer"] = $customer;
  22. $post_data["param"] = json_encode($param);
  23. $sign = md5($post_data["param"].$key.$post_data["customer"]);
  24. $post_data["sign"] = strtoupper($sign);
  25. $url = 'http://poll.kuaidi100.com/poll/maptrack.do'; //地图轨迹请求地址
  26. $params = "";
  27. foreach ($post_data as $k=>$v) {
  28. $params .= "$k=".urlencode($v)."&"; //默认UTF-8编码格式
  29. }
  30. $post_data = substr($params, 0, -1);
  31. echo '请求参数<br/>'.$post_data;
  32. //发送post请求
  33. $ch = curl_init();
  34. curl_setopt($ch, CURLOPT_POST, 1);
  35. curl_setopt($ch, CURLOPT_HEADER, 0);
  36. curl_setopt($ch, CURLOPT_URL, $url);
  37. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  38. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  39. $result = curl_exec($ch);
  40. $data = json_decode($result);
  41. echo '<br/><br/>返回数据<br/>';
  42. echo var_dump($data);
  43. ?>
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