Blogger Information
Blog 55
fans 0
comment 0
visits 58862
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
快递100接口使用
南鸢离梦的博客
Original
1249 people have browsed it
  1. //参数设置
  2. $com = input('wuliu'); // 快递公司编码
  3. $num = input('wlorder'); // 快递单号
  4. $post_data = array();
  5. $post_data["customer"] = '1234567890'; // 实时查询customer
  6. $key= '123456789' ; // 客户授权Key
  7. $post_data["param"] = "{\"com\":\"$com\",\"num\":\"$num\"}";
  8. $url='http://poll.kuaidi100.com/poll/query.do';
  9. $post_data["sign"] = md5($post_data["param"].$key.$post_data["customer"]);
  10. $post_data["sign"] = strtoupper($post_data["sign"]); // 签名
  11. $o="";
  12. foreach ($post_data as $k=>$v)
  13. {
  14. $o.= "$k=".urlencode($v)."&"; //默认UTF-8编码格式
  15. }
  16. $post_data=substr($o,0,-1);
  17. $ch = curl_init();
  18. curl_setopt($ch, CURLOPT_POST, 1);
  19. curl_setopt($ch, CURLOPT_HEADER, 0);
  20. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  21. curl_setopt($ch, CURLOPT_URL,$url);
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  23. $result = curl_exec($ch);
  24. curl_close($ch);
  25. $data = str_replace("\"",'"',$result );
  26. $data = json_decode($data,true);
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