[更新]修改kuaidi100物流查询

This commit is contained in:
Anyon 2017-07-10 14:52:16 +08:00
parent 5c5dd1e343
commit d413937451
2 changed files with 4 additions and 4 deletions

View File

@ -50,7 +50,7 @@ class Index extends Controller
public function wuliu()
{
$order = '1202247993797';
$order = '444500528707';
dump(ToolsService::express($order));
}

View File

@ -164,12 +164,12 @@ class ToolsService
public static function express($code)
{
$result = [];
$autoResult = HttpService::get("http://www.kuaidi100.com/autonumber/autoComNum?text={$code}");
$client_ip = Request::instance()->ip();
$header = ['Host' => 'www.kuaidi100.com', 'CLIENT-IP' => $client_ip, 'X-FORWARDED-FOR' => $client_ip];
$autoResult = HttpService::get("http://www.kuaidi100.com/autonumber/autoComNum?text={$code}", [], 30, $header);
foreach (json_decode($autoResult)->auto as $vo) {
$microtime = microtime(true);
$url = "http://www.kuaidi100.com/query?type={$vo->comCode}&postid={$code}&id=1&valicode=&temp={$microtime}";
$client_ip = Request::instance()->ip();
$header = ['Host' => 'www.kuaidi100.com', 'CLIENT-IP' => $client_ip, 'X-FORWARDED-FOR' => $client_ip];
$result[$vo->comCode] = json_decode(HttpService::get($url, [], 30, $header), true);
}
return $result;