Heim  >  Artikel  >  Backend-Entwicklung  >  采集练习(九) php 获得手机号归属地_PHP教程

采集练习(九) php 获得手机号归属地_PHP教程

WBOY
WBOYOriginal
2016-07-20 11:14:12821Durchsuche

  下午在群里看到朋友要,于是就稍微看了一下。发现 手机号归属地查询 基本上都是由 提供的 。各大网站都拿了这个公司的接口,于是我也想看看怎么获得我需要的信息,手机在线没有免费的接口,要查询手机归属地只能发送请求在他的网站页面 .......这方法没啥意思。

于是我继续查找,依旧是在手机在线的触屏版(m.showji.com)找到了解决方法(感谢移动互联网)。

里有个api 接口直接就可以获得 手机号归属地信息, 红色的是 ......  如下显示

http://api.showji.com/Locating/www.showji.com.aspx?m=&output=json&callback=querycallback

:

使用的时候可以去掉后面的 不然还要截取处理。

header("content-type:text/html;charset=utf-8");
$url = "http://api.showji.com/Locating/www.showji.com.aspx";
$cellPhoneNumber = "13530552275";
$setting_array = array(
	'http' => array(
	            'timeout' => 5,
	            'method' => 'GET',
	            'protocol_version'=>'1.1',
	            'header' =>
                     "User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7\r\n" .
                     "Host: api.showji.com\r\n" .
                     "Accept-Language: zh-cn,zh;q=0.8\r\n" .               
                     "Accept: */*\r\n" .
                     "Referer:http://m.showji.com/\r\n" .
                     "Connection: keep-alive\r\n\r\n"
	         )
);
$headers = stream_context_create($setting_array);
//$jsons = file_get_contents($url."?m=".$cellPhoneNumber."&output=json",FALSE,$headers); //这样打开要10s
$jsons = file_get_contents($url."?m=".$cellPhoneNumber."&output=json");// 直接打开1s不到
$cellPhoneInfo = json_decode($jsons,true);
print_r($cellPhoneInfo);
//360的接口
echo file_get_contents("http://apps.qiyigoo.com/telsearch/get_tel.php?_=1370366237601&do=get_tel_info&teltype=phone&phone=13530552275&1370366237599");

当然也有一 个接口 不过返回的信息有点少,就返回城市、卡信息。

红色的是  蓝色的是  请求的时候要自己替换。。

http://apps.qiyigoo.com/telsearch/get_tel.php?_=&do=get_tel_info&teltype=phone&phone=&

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440317.htmlTechArticle下午在群里看到朋友要 ,于是就稍微看了一下。发现手机号归属地 查询 基本上都是由 提供的 。各大网站都拿了这个公司的接口,于是我...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn