- 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的地址信息
- //该片段来自于http://www.codesnippet.cn/detail/030620149714.html
来源: http://www.codesnippet.cn/detail/030620149714.html