获取访客ip地址信息的代码

http://pv.sohu.com/cityjson?ie=utf-8

返回的ip,行政区域及具体市

<script type="text/javascript" language="javascript">
var Myurl=document.URL
var urlcs=Myurl.split('?')[1];
var pid=urlcs.split('&')[0];
if(pid!=undefined)document.getElementById("ProID").value=pid;
</script>
<script type="text/javascript" src="http://pv.sohu.com/cityjson"></script>
<script>
var ip = returnCitySN['cip'];
if(ip!=undefined)document.getElementById("ip").value=ip;
</script>

还有个调用新浪的

<script type="text/javascript" src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"></script>
<script>
var local = '';
if(remote_ip_info['city'] == "")
{

 local = remote_ip_info['province'];
}
else
{
 local = remote_ip_info['city'];
}
</script>

发表评论