龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

ip地址归属地接口

时间:2014-07-22 14:48来源: 作者: 点击:
分享到:
返回归属地 isp 等ip地址信息指定ip时会显示指定ip的地址信息Array ( [ret] = 1 [start] = 124.128.0.0 [end] = 124.128.255.255 [country] = 中国 [province] = 山东 [city] = 济南 [district] = [isp] = 联通 [type] = [desc
返回归属地 isp 等ip地址信息
指定ip时会显示指定ip的地址信息Array ( [ret] => 1 [start] => 124.128.0.0 [end] => 124.128.255.255 [country] => 中国 [province] => 山东 [city] => 济南 [district] => [isp] => 联通 [type] => [desc] => )
不知道时,会显示运行代码的服务器ip地址信息
function ip2add($ip=''){
$json = file_get_contents('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip='.$ip);
$address = json_decode($json,true);
return $address;
}
print_r(ip2add());//会显示服务器的ip地址信息
print_r(ip2add('124.128.61.235'));//显示指定ip的地址信息
精彩图集

赞助商链接