原创作者: jackyrong   阅读:3098次   评论:2条   更新时间:2011-05-26    
今天偶然发现,QQ居然有个地址http://fw.qq.com/ipaddress
可以获得来访的用户的IP地址和省,市,因此转一下笔记下

< ?php
    function get_ip_place(){  
  $ip=file_get_contents("http://fw.qq.com/ipaddress");     $ip=str_replace('"',' ',$ip);   
$ip2=explode("(",$ip);    
$a=substr($ip2[1],0,-2);  
  $b=explode(",",$a);    
return $b;   
}  
  $ip=get_ip_place();  
  print_r($ip); ?>
评论 共 2 条 请登录后发表评论
2 楼 hizhengfu 2011-03-22 09:46
这个只要腾讯不屏蔽的话,倒是省掉自带IP数据库了,这个返回的是长度为4的数组,不清楚其它两个的含义了。我这访问下来的[1],[3]是空字符串。
1 楼 vb2005xu 2011-02-17 10:01
<html>
<head>
	<title>获取ip地址</title>
	<script src="http://fw.qq.com/ipaddress" type="text/javascript"></script>
	<script type="text/javascript">
		function test(){
			alert(IPData[0])
		}
	</script>
</head>
<body onload="test()">
</body>
</html>

发表评论

您还没有登录,请您登录后再发表评论

文章信息

Global site tag (gtag.js) - Google Analytics