淘宝IP地址查询接口:http://ip.taobao.com/service/getIpInfo.php?ip=【ip地址】
$url='http://ip.taobao.com/service/getIpInfo.php?ip=113.118.198.201';
$result = file_get_contents($url);
$result = json_decode($result,true);
结果例子:
Array
(
[country] => 中国
[country_id] => CN
[area] => 华南
[area_id] => 800000
[region] => 广东省
[region_id] => 440000
[city] => 深圳市
[city_id] => 440300
[county] =>
[county_id] => -1
[isp] => 电信
[isp_id] => 100017
[ip] => 113.118.198.201
)
优点:数据返回的是json格式,数据信息详细,调用方便。
缺点:访问限制,最近经常出现502.
搜狐IP地址查询接口(默认GBK):http://pv.sohu.com/ci