首页 > Web开发 > 详细

php查询快递信息

时间:2017-02-28 19:05:31      阅读:176      评论:0      收藏:0      [点我收藏+]
$code 		= ‘shunfeng‘;
$invoice 	= ‘952255884068‘;
$test 		= getExpressDelivery($code,$invoice);

function getExpressDelivery($code,$invoice){
    $result = array(‘status‘=>0,‘info‘=>‘未知错误‘);
    $url = "http://m.kuaidi100.com/query?type={$code}&postid={$invoice}&id=1&valicode=&temp=".rand(1,710);
    $body = file_get_contents($url); //FIXME
    $body = json_decode($body,true);
    $result[‘status‘] = $body[‘status‘] == 200 ? 1 : 0;
    $result[‘info‘] = $body[‘message‘];
    isset($body[‘data‘]) && ($result[‘state‘]=$body[‘state‘]) && ($result[‘data‘] = $body[‘data‘]) ;
    return $result;
}    

 

php查询快递信息

原文:http://www.cnblogs.com/wanghaokun/p/6480011.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!