分享个免费IP地址查询API接口,PHP的,其他语言自己看着写吧
function getip($ip) {
$url = "http://whois.pconline.com.cn/ipJson.jsp?json=true&ip=$ip";
$res1 = file_get_contents($url);
$res1 = iconv('GBK','utf-8', $res1);
$res = json_decode($res1, true);
if ($res) {
$address = $res['addr'];
return $address;
}
}