新浪:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js
返回数据:var remote_ip_info = {"ret":1,"start":"27.16.0.0","end":"27.19.255.255","country":"\u4e2d\u56fd","province":"\u6e56\u5317","city":"\u6b66\u6c49","district":"","isp":"\u7535\u4fe1","type":"","desc":""}
调用办法:<script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js" type="text/javascript"></script<script language="javascript">document.write(remote_ip_info.city);</script>
此接口貌似本能机能返回IP对应的国度省市,IP地址貌似取不到
新浪:http://counter.sina.com.cn/ip
返回数据:var ILData = new Array("27.19.69.47","保存地址", "", "", ""); if (typeof(ILData_callback) != "undefined") { ILData_callback(); }
调用办法:同上,document.write(ILData[0])
该接口可以可以查询指定IP的信息,只须要加上ip参数即可
例如:http://counter.sina.com.cn/ip?ip=119.75.217.56
返回数据:var ILData = new Array("119.75.217.56","中国", "北京市", "(百度公司)", "网通"); if (typeof(ILData_callback) != "undefined") { ILData_callback(); }
此接口返回的是一个数组,包含5个元素:IP地址、国度、省市、所属单位、办事商
有道:http://www.youdao.com/smartresult-xml/search.s
查询ip参数:?type=q&ip=119.75.217.56
返回数据:119.75.217.56 北京市 百度公司
查询手机号参数:?type=mobile&q=13387617842
返回数据:13387617842 湖北 武汉
ASP抓取:
// 使用第三方接口来查询IP所对应的省份
//LoginIp = "122.235.140.99";
WebClient WebGet = new WebClient();
string result = WebGet.DownloadString("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=" + LoginIp);
result = result.Substring("var remote_ip_info =".Length);