IP地址归属地查询接口



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:

这里介绍网易有道在上面发布的三款免费API,毕竟是大公司,速度有保证,所以拿来与大家分享一下。当然其他的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>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值