1、新浪IP API:
新浪这个应该说是最不错的。并且返回的数据类型为可以自定义格式(默认为纯文本格式,根据format的参数定义,还可以返回JS、Json格式。下面列举的是JS的格式)。
http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js
返回值数据格式:var remote_ip_info = {"ret":1,"start":"59.37.164.179","end":"59.37.165.17","country":"\u4e2d\u56fd","province":"\u5e7f\u4e1c","city":"\u6c5f\u95e8","district":"","isp":"\u7535\u4fe1","type":"","desc":""};
http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=61.135.169.105
返回值数据格式:var remote_ip_info = {"ret":1,"start":"61.135.164.0","end":"61.135.191.255","country":"\u4e2d\u56fd","province":"\u5317\u4eac","city":"\u5317\u4eac","district":"","isp":"\u8054\u901a","type":"","desc":""};
2、淘宝IP API:
http://ip.taobao.com/service/getIpInfo.php?ip=127.0.0.1
直接在URL里传递IP数据,即可获取JSON格式的返回数据。
{“code”:0,”data”:{“country”:”IANA”,”country_id”:”9999″,”area”:”",”area_id”:”-1″,”region”:”",”region_id”:”-1″,”city”:”",”city_id”:”-1″,”county”:”",”county_id”:”-1″,”isp”:”",”isp_id”:”-1″,”ip”:”127.0.0.1″}}
其中code的值为0代表IP地址解析成功,1代表失败。
3、网易 API:
这三款接口都是以URL GET方式提交参数,以XML的形式返回查询结果
查询IP地址:
http://www.youdao.com/smartresult-xml/search.s?type=ip&q=IP地址
举例:http://www.youdao.com/smartresult-xml/search.s?type=ip&q=123.233.157.9
返回:
<?xml version="1.0" encoding="gbk"?>
<smartresult>
<product type="ip">
<ip>123.233.157.9</ip>
<location>山东省济南市 网通</location>
</product>
</smartresult>
查询手机号码归属地:
http://www.yodao.com/smartresult-xml/search.s?type=mobile&q=手机号
举例:http://www.yodao.com/smartresult-xml/search.s?type=mobile&q=13892101111
返回:
<?xml version="1.0" encoding="gbk"?>
<smartresult>
<product type="mobile">
<phonenum>13892101111</phonenum>
<location>陕西 延安</location>
</product>
</smartresult>
查询身份证信息:
http://www.yodao.com/smartresult-xml/search.s?type=id&q=身份证号码
举例:http://www.youdao.com/smartresult-xml/search.s?type=id&q=370782196402121133
返回:
<?xml version="1.0" encoding="gbk"?>
<smartresult>
<product type="identitycard">
<code>370782196402121133</code>
<location>山东省潍坊市诸城市</location>
<birthday>19640212</birthday>
<gender>m</gender>
</product>
</smartresult>