IP地址查询接口及调用方法

  • 新浪IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js
  • 搜狐IP地址查询接口:http://pv.sohu.com/cityjson
  • 谷歌IP地址查询接口:http://j.maxmind.com/app/geoip.js
  • 有道IP地址查询接口:http://www.youdao.com/smartresult-xml/search.s
  • 1616 IP地址查询接口:http://w.1616.net/chaxun/iptolocal.php
  • 126 http://ip.ws.126.net/ipquery
  • hao123 http://app.hao123.com/ipquery/getcity.php?rtype=2
  • 淘宝 http://ip.taobao.com/service/getIpInfo.php?ip=117.89.35.58
  • 太平洋电脑网 http://whois.pconline.com.cn

新浪接口调用:

<script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"></script>
<script type="text/javascript">
//format参数设置返回格式 js/json
//ip 要查询IP 可选
//反回格式如下:
//var remote_ip_info = {"ret":1,"start":"117.89.35.0","end":"117.89.35.255","country":"u4e2du56fd","province":"u6c5fu82cf","city":"u5357u4eac","district":"u767du4e0b","isp":"u7535u4fe1","type":"","desc":""};
console.log(remote_ip_info["country"]+','+remote_ip_info["province"]+"省"+','+remote_ip_info["city"]+"市")//中国,江苏省,南京市
</script>


原文地址:https://www.cnblogs.com/Alight/p/3934650.html