php 查询手机号归属接口

<?php  
//手机号查询归属地
    function mobileAscription($mobile){
        $url = "https://chong.qq.com/tws/mobileqqprequery/GetMobileProductInfo?loginstate=1&vb2ctag=4_2038_1_1425_73&groupid=2038&productype=3&mobile={$mobile}&amount=3000%235000%2310000%2320000%2330000%2350000";
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
        $data = curl_exec($curl);
        curl_close($curl);
        $data = mb_convert_encoding($data,'UTF-8','UTF-8,GBK,GB2312,BIG5');
        $resp = json_decode($data,true);
        $data = ['province'=>$resp['province'],'city'=>$resp['city'],'isd'=>$resp['isd']];
        return $data;
    }

var_dump($this->mobileAscription($mobile));

  

posted on 2022-12-29 11:41  kevin_yang123  阅读(343)  评论(0编辑  收藏  举报