显示IP地址

以有道的

function get_address_from_ip($ip)
{
$url='http://www.youdao.com/smartresult-xml/search.s?type=ip&q=';

$xml=file_get_contents($url.$ip);

$data=simplexml_load_string($xml);

return $data->product->location;

}

测试IP:

112.94.144.132

112.22.134.132

111.2.194.23

220.181.108.165

112.120.104.132

112.99.177.132

112.19.254.132

 

海外

156.2.194.132

197.2.194.132

111.92.194.23

220.101.188.115

使用如下:

<?php
echo get_address_from_ip("112.94.144.132");
?>

其他IP查询网:http://www.ip138.com/ips1388.asp?ip=

posted @ 2012-09-27 10:10  tinyphp  Views(258)  Comments(0Edit  收藏  举报