超简单的一个淘宝IP定位的API,支持国,省,市,地理ID。
调用方法:
$url
=
"http://ip.taobao.com/service/getIpInfo.php?ip="
;
$ip
=
$_SERVER
[
'REMOTE_ADDR'
];
$Result
=
file_get_contents
(
$url
.
$ip
);
$AddressJson
= json_decode(
$Result
,true);
返回结果:
Array
(
[code] => 0
[data] => Array
(
[country] => 中国
[country_id] => CN
[area] => 西南
[area_id] => 500000
[region] => 四川省
[region_id] => 510000
[city] => 成都市
[city_id] => 510100
[county] =>
[county_id] => -1
[isp] => 联通
[isp_id] => 100026
[ip] => 175.152.x.x
)
)