- /**
- * @desc 获取快递信息
- * @param string $code 快递编码
- * @param string $invoice 快递单号
- * @return mixed $result('status','info','state','data')
- */
- 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;
- }
来源: https://www.php1.cn/detail/php-608b9502e6.html