导航:首页 > 编程语言 > php判断手机号码归属地

php判断手机号码归属地

发布时间:2022-08-04 16:53:17

① 怎么查询手机号归属地区

联通手机卡用户可以通过以下渠道查询手机号码归属地:
1、登录中国联通APP,点击菜单“服务-查询-基础查询-号码归属地”,根据页面提示输入需要查询的手机号码,再点击“查询”。
2、进入中国联通网上营业厅,点击菜单“查询-其他业务查询-号码归属地查询”,根据页面提示输入需要查询的手机号码,再点击“查询”。
3、拨打当地联通客服热线10010,根据语音提示转人工服务查询。

php用IP查询归属地

class ip_location
{
function init()
{
$this->wrydat = 'ip_area.dat';

$this->fp = fopen($this->wrydat, 'rb');
$this->getipnumber();
$this->getwryversion();

$this -> REDIRECT_MODE_0 = 0;
$this -> REDIRECT_MODE_1 = 1;
$this -> REDIRECT_MODE_2 = 2;
}

function get($str)
{
return $this->$str;
}

function set($str,$val)
{
$this->$str = $val;
}

function getbyte($length,$offset=null)
{
!is_null($offset) && fseek($this->fp, $offset, SEEK_SET);

return fread($this->fp, $length);
}

function packip($ip)
{
return pack('N', intval(ip2long($ip)));
}

function getlong($length=4, $offset=null)
{
$chr=null;
for($c=0;$length%4!=0&&$c<(4-$length%4);$c++)
{
$chr .= chr(0);
}
$var = unpack( 'Vlong', $this->getbyte($length, $offset).$chr);
return $var['long'];
}

function getwryversion()
{
$length = preg_match("/coral/i",$this->wrydat)?26:30;
$this->wrydat_version = $this->getbyte($length, $this->firstip-$length);
}

function getipnumber()
{
$this->firstip = $this->getlong();
$this->lastip = $this->getlong();
$this->ipnumber = ($this->lastip-$this->firstip)/7+1;
}

function getstring($data='', $offset=NULL)
{
$char = $this->getbyte(1,$offset);
while(ord($char) > 0)
{
$data .= $char;
$char = $this->getbyte(1);
}
return $data;
}

function iplocaltion($ip)
{
$ip = $this->packip($ip);
$low = 0;
$high = $this->ipnumber-1;
$ipposition = $this->lastip;
while($low <= $high)
{
$t = floor(($low+$high)/2);
if($ip < strrev($this->getbyte(4,$this->firstip+$t*7)))
$high = $t - 1;
else
{
if($ip > strrev($this->getbyte(4,$this->getlong(3))))
$low = $t + 1;
else
{
$ipposition = $this->firstip+$t*7;
break;
}
}
}
return $ipposition;
}

function getarea()
{
$b = $this->getbyte(1);
switch(ord($b))
{
case $this -> REDIRECT_MODE_0 :
return '';
break;
case $this -> REDIRECT_MODE_1:
case $this -> REDIRECT_MODE_2:
return $this->getstring('',$this->getlong(3));
break;
default:
return $this->getstring($b);
break;
}
}

function getiplocation($ip)
{
$ippos = $this->iplocaltion($ip);
$this->ip_range_begin = long2ip($this->getlong(4,$ippos));
$this->ip_range_end = long2ip($this->getlong(4,$this->getlong(3)));
$b = $this->getbyte(1);
switch(ord($b))
{
case $this -> REDIRECT_MODE_1:
$b = $this->getbyte(1,$this->getlong(3));
if(ord($b) == $this -> REDIRECT_MODE_2)
{
$countryoffset = $this->getlong(3);
$this->area = $this->getarea();
$this->country = $this->getstring('',$countryoffset);
}
else
{
$this->country = $this->getstring($b);
$this->area = $this->getarea();
}
break;
case $this -> REDIRECT_MODE_2:
$countryoffset = $this->getlong(3);
$this->area = $this->getarea();
$this->country = $this->getstring('',$countryoffset);
break;
default:
$this->country = $this->getstring($b);
$this->area = $this->getarea();
break;
}
}
}

---------------------------------------------------------------

调用方法:

$iploca = new ip_location;
$iploca -> init();
$iploca -> getiplocation($ip);

$area['country'] = str_replace(array('CZ88.NET'), '', $iploca -> get('country'));
$area['area'] = str_replace(array('CZ88.NET'), '', $iploca -> get('area'));

$area['country']=='' && $area['country']='未知';
$area['area']=='' && $area['area']='未知';
return $area;

③ 怎么查询号码归属地

您好,用户查询手机号的归属地信息,直接打开手机的拨号界面,输入需要查看的手机号,然后界面上会显示具体的号码归属地信息的,也可以打开手机浏览器在搜索框上直接输入手机号,也可以查询到号码的归属地情况的

回答仅供参考,更多安徽电信套餐,业务资讯可以关注安徽电信公众号。

④ 如何查询电话号码是哪个城市的

联通手机卡用户可通过以下渠道查询手机号码归属地:
1、登录中国联通APP,点击菜单“服务-查询-通用查询-号码归属地”,根据页面提示输入需要查询的手机号码,再点击“查询”。
2、通过中国联通网上营业厅,点击菜单“查询-其他业务查询-号码归属地查询”,根据页面提示输入需要查询的手机号码,再点击“查询”。
3、拨打当地联通客服热线,根据语音提示转人工服务查询。

⑤ 如何查看手机归属地在哪里

联通手机号码的归属地,可以通过以下方式查看:
1、登录中国联通APP,点击菜单“服务-查询-通用查询-号码归属地”,根据页面提示输入需要查询的手机号码,再点击“查询”。
2、中国联通网上营业厅,点击菜单“查询-通用查询-号码归属地查询”,根据页面提示输入需要查询的手机号码,再点击“查询”。
3、拨打当地联通客服热线10010,根据语音提示转人工服务查询。

⑥ 在html页面输入手机号码,提交后php,查询手机手机归属地,记录该次查询到mysql数据,并将归属地输出到网页

查询归属地可以去网上找开放接口调用 前台输入手机号码查询的时候调用接口 接口调用结果一般是json格式的把他转成数组按照键名拿到你要的数据传参到前台页面显示就可以了 同时你也可以把拿到的数据存入数据库

⑦ 如何查询手机号码的归属地

原因及方法

号码归属地显示功能是由手机上的归属地软件完成的,由于使用人数的增多,通信运营商会由手机上的归属地软件完成的,由于使用人数的增多,通信运营商会启用新号段进行发售,而这些新号段的归属地没有在归属地软件数据库里得到及时更新,所以就出现了错误的显示。

原先没装归属地软件的手机用户,可为手机更新归属地软件。

简介

当你用智能手机接听电话时,基本都会显示手机号码来自哪个地方,而这个地方也就是号码归属地。归属地的单位是市,即你的号码离开你号码所在的那个市,准确地说是离开电信公司在各个市所划分的网络区域时,这就形成漫游。

⑧ 如何用php编写手机归属地查询果壳网

代码如下:

<?php
header(“Content-Type:text/html;charset=utf-8″);
if(isset($_GET['number'])){
$url=‘http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo';
$number=$_GET['number'];
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,“mobileCode={$number}&userId=”);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$data=curl_exec($ch);
curl_close($ch);
$data=simplexml_load_string($data);
if(strpos($data,‘http://')){
echo‘手机号码格式错误!';
}else{
echo$data;
}
}
?>
<formaction=”mobile.php”method=”get”>
手机号码:<inputtype=”text”name=”number”/><inputtype=”submit”value=”提交”/>
</form>
阅读全文

与php判断手机号码归属地相关的资料

热点内容
解压玩具创意图片 浏览:525
组态软件pdf 浏览:484
箍筋加密区是如何计算根数的 浏览:852
笔记本如何服务器从做raid 浏览:929
视频编解码算法工程师 浏览:587
手机上服务器怎么找 浏览:323
抖音程序员变装男 浏览:338
qd128y压缩机参数 浏览:834
解压棒的视频 浏览:145
linux下kill命令 浏览:346
服务器和网络机柜有什么重要 浏览:349
贴吧文件夹位置图片 浏览:506
python读取处理二进制文件 浏览:398
亿速云北京三区云服务器 浏览:566
高管绿程序员 浏览:43
萝卜影视APP源码推荐设置教程 浏览:782
小米官方包被加密 浏览:884
程序员的午饭视频 浏览:289
雅思听力pdf 浏览:359
高跟鞋先生程序员 浏览:59