根据百度api获取号码的归属地
$mobile = "173*****123";
$json = file_get_contents('http://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php? resource_id=6004&ie=utf8&oe=utf8&query='.$mobile);
$arr = json_decode($json,true);
echo "<pre>";
echo $arr;
echo "</pre>";
返回值:
array:4 [
“status” => “0”
“t” => “”
“set_cache_time” => “”
“data” => array:1 [
0 => array:30 [
“StdStg” => 6054
“StdStl” => 8
“_update_time” => “1572265674”
“cambrian_appid” => “0”
“city” => “郑州”
“key” => “173”
“prov” => “河南”
“showurl” => “https://anquan.baidu.com/page/41”
“title” => “XXX”
“type” => “中国电信”
“url” => “https://anquan.baidu.com/page/41”
“loc” => “http://open.baidu.com/q?r=2012696&k=173”
“SiteId” => 2006296
“_version” => 29874
“_select_time” => 1572265674
“querytype” => “手机号码”
“phoneinfo” => “手机号码"173123""
“phoneno” => "173123”
“origphoneno” => “173123"
“titlecont” => “手机号码归属地查询”
“showlamp” => “1”
“clickneed” => “0”
“ExtendedLocation” => “”
“OriginQuery” => "173123”
“tplt” => “mobilephone”
“resourceid” => “6054”
“fetchkey” => “6054_173”
“appinfo” => “”
“role_id” => 1
“disp_type” => 0
]
]
]