号码归属地

/**
 * 获取手机归属地
 * @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;
    }
}
posted @ 2019-11-25 14:19  TBHacker  阅读(217)  评论(0编辑  收藏  举报