获取客户端公网IP
搜狐接口
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
数据格式
var returnCitySN = {"cip": "182.239.114.113", "cid": "810000", "cname": "香港特别行政区"};
使用
<script type="text/javascript">
document.write(returnCitySN["cip"]+','+returnCitySN["cname"])
</script>
淘宝接口
POST : http://ip.taobao.com/outGetIpInfo
参数
ip:myip
accessKey:alibaba-inc
数据格式
{
"data": {
"area": "",
"country": "中国",
"isp_id": "100025",
"queryIp": "182.239.114.113",
"city": "XX",
"ip": "182.239.114.113",
"isp": "移动",
"county": "",
"region_id": "810000",
"area_id": "",
"county_id": null,
"region": "香港",
"country_id": "HK",
"city_id": "xx"
},
"msg": "query success",
"code": 0
}
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 lzdong@foxmail.com