導航:首頁 > 編程語言 > 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判斷手機號碼歸屬地相關的資料

熱點內容
好興動app還款怎麼登錄不上去了 瀏覽:665
鄭州雲伺服器託管 瀏覽:722
伺服器地址跟蹤 瀏覽:980
免費google雲伺服器 瀏覽:516
摘譯和編譯的英文 瀏覽:359
熱泵壓縮機選型 瀏覽:121
op手機微信加密如何解除 瀏覽:386
如何在王牌戰爭找到高爆率伺服器 瀏覽:13
江浙小學語文輔導課用什麼APP 瀏覽:99
新夢幻大陸伺服器地址 瀏覽:241
網吧伺服器怎麼更換壁紙 瀏覽:530
linux命令方法 瀏覽:332
linux下載freetype 瀏覽:123
程序員入駐平台 瀏覽:327
程序員大戰外掛 瀏覽:745
html實例教程pdf 瀏覽:157
linux命令開放所有許可權 瀏覽:575
30歲能學會編程 瀏覽:737
小火箭的伺服器是什麼 瀏覽:967
cad查信息命令 瀏覽:402