调用搜狐接口获取ip
--lua语音获取ip
--返回gbk编码
curl http://pv.sohu.com/cityjson?ie=gbk2312
--返回u8编码
curl http://pv.sohu.com/cityjson?ie=utf-8
//js中调用
//1.现在html中引入
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
//2.js脚本中获取ip
<script type="text/javascript">
//脚本中获取,cip为要获取的ip,cname为ip所在城市
document.write(returnCitySN["cip"]+','+returnCitySN["cname"])
</script>
浏览器中访问:
http://pv.sohu.com/cityjson?ie=utf-8