多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 快递100物流记录接口 - 云平台: https://cloud.kuaidi100.com/ - 接口/产品: http://cloud.kuaidi100.com/xsinglex/productdetail?id=32164353180 - 快递公司代号: https://blog.csdn.net/u011816231/article/details/53063611 #### code ```php /** * @api {GET} express/query 查询物流跟踪信息 * @apiGroup 快递物流 * @apiParam {string} com 快递公司代号 * @apiParam {string} nu 运单编号 */ public function query($com, $nu) { $woc['com'] = $com; $woc['num'] = $nu; $woc['from']=''; $woc['phone']=''; $woc['resultv2']=0; $woc['show']='0'; $woc['to']=''; $woc['order']='desc'; $secret_secret = '你的secret_secret'; $param['secret_key'] = '你的secret_key'; $param['secret_code'] ='你的secret_code'; $param['secret_sign']=strtoupper(md5($param['secret_key'].$secret_secret)); $param['param'] = json_encode($woc); $ch=curl_init(); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_HEADER,0); curl_setopt($ch,CURLOPT_URL,'http://cloud.kuaidi100.com/api'); curl_setopt($ch,CURLOPT_POSTFIELDS,$param); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $res = curl_exec($ch); curl_close($ch); $dump = json_decode($res, true); if ($dump['status'] == 200) { $dump['code'] = 0; if (isset($dump['state'])) { $dump['state_txt'] = ''; // 包括0在途,1揽收,2疑难,3签收,4退签,5派件,6退回等7个状态 switch ($dump['state']) { case 0: $dump['state_txt'] = '在途'; break; case 1: $dump['state_txt'] = '揽收'; break; case 2: $dump['state_txt'] = '疑难'; break; case 3: $dump['state_txt'] = '签收'; break; case 4: $dump['state_txt'] = '退签'; break; case 5: $dump['state_txt'] = '派件'; break; case 6: $dump['state_txt'] = '退回'; break; } } } else { $dump['code'] = 1; $dump['msg'] = '查询失败'; } return response($dump, 200, [], 'json'); } ```