物流问答
个人怎么获取爱快递 API key?
key=ff4735a30a7a4e5a8637146fd0e7cec9
以下为php代码
$kdh = substr($keyword,2,18);
$kdgs=array(“zhongtong”,”shentong”,”yuantong”,”yunda”,”shunfeng”,”huitong”,”ems”,”tiantian”,”suning”,”zjs”,”debang”,”dhl”,”kuaijie”);
$status=array(=>查询犯错,1=>暂无记载,2=>在途中,3=>派送中,4=>已签收,5=>拒收,6=>疑问件,7=>退回);//构建快递状况数组
$arrlength=count($kdgs);
for($x=0;$x<$arrlength;$x++){
$kuaidiurl=”http://www.***.cn/rest/?key=ff4735a30a7a4e5a8637146fd0e7cec9&order={$kdh}&id={$kdgs$x}&show=xml”;//快递地址
$kuaidistr=file_get_contents($kuaidiurl);//读入文件
$kuaidiobj=simplexml_load_string($kuaidistr);//xml解析
$kuaidistatus = $kuaidiobj->Status;//获取快递状况
$kuaistr=strval($kuaidistatus);//目标转换为字符串
if($kuaistr>=2){goto a;}//查找有记载则跳出循环
}
a:$contentStr0 =$status$kuaistr;//依据数组回来
foreach ($kuaidiobj->Data->Order as $a)
{xa0xa0
foreach ($a->Time as $b)
{
foreach ($a->Content as $c)
{$m.=”{$b}{$c}”;}
}
}
//遍历获取快递时刻和事情
$contentStr=”你的快递单号:{$kdh} {$contentStr0} {$m}”;xa0 xa0}xa0 xa0 xa0
以上为php代码,实测能够用的。运用作用如下,有问题能够重视大众号来沟通。
望采用!
http://www.yuntisoft.com/wuliuwenda/16756.html 个人怎么获取爱快递 API key?