doExpress($code, $number))) { if (!empty($result['data']['info']['context'])) { foreach ($result['data']['info']['context'] as $vo) $list[] = [ 'time' => date('Y-m-d H:i:s', $vo['time']), 'context' => $vo['desc'], ]; return ['message' => 'ok', 'com' => $code, 'nu' => $number, 'data' => $list]; } } return ['message' => 'ok', 'com' => $code, 'nu' => $number, 'data' => $list]; } /** * 执行百度快递100应用查询请求 * @param string $code 快递公司编号 * @param string $number 快递单单号 * @return mixed */ private function doExpress($code, $number) { list($microtime, $clientIp) = [time(), $this->app->request->ip()]; $url = "https://sp0.baidu.com/9_Q4sjW91Qh3otqbppnN2DJv/pae/channel/data/asyncqury?cb=callback&appid=4001&com={$code}&nu={$number}&vcode=&token=&_={$microtime}"; $options = ['cookie_file' => $this->app->getRuntimePath() . 'express_cookie.txt', 'headers' => ['Host' => 'www.kuaidi100.com', 'CLIENT-IP' => $clientIp, 'X-FORWARDED-FOR' => $clientIp],]; return json_decode(str_replace('/**/callback(', '', trim(http_get($url, [], $options), ')')), true); } }