标签:@param data 号码 result one cat code public stat
/**
* 获取手机归属地
* @param $telephone
* @return bool
*/
public static function getPhoneLocation($telephone) {
$urlBt = 'http://tool.bitefu.net/shouji';
$dataBt['mobile'] = $telephone;
$urlJh = 'http://apis.juhe.cn/mobile/get';
$dataJh['phone'] = $telephone;
$dataJh['key'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$dataJh['dtype'] = '';
$return_data = json_decode(Http::newDoGet($urlBt,$dataBt,3),true);
if ((string)$return_data['status'] === '1') {
$out['province'] = $return_data['province'];
$out['city'] = $return_data['city'];
$out['code'] = $return_data['citycode'];
return $out;
} else {
$return_data = json_decode(Http::newDoGet($urlJh,$dataJh,3),true);
if ((string)$return_data['resultcode'] === '200') {
$out['province'] = $return_data['result']['province'];
$out['city'] = $return_data['result']['city'];
$out['code'] = $return_data['result']['areacode'];
return $out;
}
return false;
}
}
标签:@param data 号码 result one cat code public stat
原文地址:https://www.cnblogs.com/jiqing9006/p/11927501.html