快递物流查询接口(阿里云市场接口),调用示例

编程入门 行业动态 更新时间:2024-10-14 06:20:13

快递物流查询<a href=https://www.elefans.com/category/jswz/34/1771365.html style=接口(阿里云市场接口),调用示例"/>

快递物流查询接口(阿里云市场接口),调用示例

//获取阿里云市场,快递物流记录 .html?spm=5176.2020520132.101.26.61f97218v18GBF#sku=yuncode1627300000

//get_express_log(self::$config['web']['aliyun_AppCode']阿里云市场 AppCode,缓存秒数如 300秒,'快递公司代码,如:STO',快递单号,如:3398499691970);
//self::$config['web']是梦行框架的配置变量
function get_express_log($appcode,$show_express_cache,$type,$code){ $cache_path='./express_cache/'.md5($type.$code).'.express'; $cache_file_time=@filemtime($cache_path)+$show_express_cache*60; if(time()<$cache_file_time){return file_get_contents($cache_path);} $host = ""; $path = "/kdwlcx"; $method = "GET"; //$appcode = "a9e85f0ded814bc7a97a9f3ad5ccab01"; $headers = array(); array_push($headers, "Authorization:APPCODE " . $appcode); $querys = "no=".$code."&type=".$type; $bodys = ""; $url = $host . $path . "?" . $querys; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); //curl_setopt($curl, CURLOPT_HEADER, true); 如不输出json, 请打开这行代码,打印调试头部状态码。 //状态码: 200 正常;400 URL无效;401 appCode错误; 403 次数用完; 500 API网管错误 if (1 == strpos("$".$host, "https://")) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } $out_put = curl_exec($curl); file_put_contents($cache_path,$out_put); return $out_put; }

 

转载于:.html

更多推荐

快递物流查询接口(阿里云市场接口),调用示例

本文发布于:2024-03-06 08:24:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1714841.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:接口   阿里   示例   快递   物流

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!