/推荐使用新浪的:
$ch = curl_init();
$url = "http://ip.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=202.102.3.141"; //测试202.102.3.141 江苏省常州市
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10); $sourceInfo_sina = json_decode(curl_exec($ch)); //淘宝(经实际使用发现,数据老旧,地区不准):
$ch = curl_init();
$url = "http://ip.taobao.com/service/getIpInfo.php?ip=202.102.3.141"; //测试202.102.3.141 江苏省常州市
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10); $sourceInfo_taobao = json_decode(curl_exec($ch));