IP地址的位置检测技术 [英] Location detecting techniques for IP addresses

查看:90
本文介绍了IP地址的位置检测技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是IP地址的位置检测技术?

我知道查看

$ _ SERVER ['HTTP_ACCEPT_LANGUAGE'] (不准确,但主要用于检测位置,例如,如果IP范围的用户将法语设置为浏览器,则表示此范围)属于法国



gethostbyaddr($ _ SERVER ['REMOTE_ADDR'])(查看国家/地区代码顶级域名)

然后可能是whois gethostbyaddr($ _ SERVER ['REMOTE_ADDR'])


有时:

$ HTTP_USER_AGENT Firefox的用户代理字符串有语言代码,但不准确,但大多可用于检测位置)







我还知道如何获取时区,但它确实不适用于新的浏览器。
此外还有 css问题可检测访客的历史记录,可用于查看他/她访问过的谷歌和维基百科页面(google.co.uk,google.com.tr)。

但是,城市又如何?

/供应商。有些商业产品可供您使用,例如 ip2location 。然而,AFAIK没有免费的替代方案,因为维护这样一个IP数据库是相当多的工作。自由选择: GeoIP2



更新:
有几件事情可以让你创建这样一个分贝,如果你投入足够的时间:


  1. 使用由区域和当地注册局找到知识产权的所有者。

  2. 许多ISP使用允许您定位用户的命名模式。有时,如果您进行反向DNS查找,您甚至可以以纯文本的形式读取城市名称。有时候更隐秘的是
    。例如,我目前有p5dcf6c4a.dip.t-dialin.net,而且我没有
    这个命名方案。

  3. 使用traceroute。如果您无法识别用户的位置,您仍然可以找到
    上行链路的位置


What are the location detecting techniques for IP addresses?
I know to look at the
$_SERVER['HTTP_ACCEPT_LANGUAGE'] (not accurate but mostly useful to detect location, for example if an IP range's users set French to their browser then it means that this range) belongs to France
and
gethostbyaddr($_SERVER['REMOTE_ADDR']) (to look country code top-level domain)
then may be to whois gethostbyaddr($_SERVER['REMOTE_ADDR'])
sometimes:
$HTTP_USER_AGENT (Firefox's user agent string has language code, not accurate but mostly can be used to detect the location)

Also I know how to get the time zone but it does not work in the new browsers. Moreover there is css issue that detects visitor's history, it can be used to see what google and wikipedia pages he/she has visited (google.co.uk, google.com.tr)

But what about cities?

解决方案

You can't do this without a database that maps IP addresses to cities/countries/providers. There are commercial offerings such as ip2location that you could use. AFAIK there is no free alternative though, as maintaining such a IP database is quite a lot of work. Free alternative: GeoIP2

Update: There are several things that allow you to create such a db, if you invest enough time:

  1. Use the databases provided by regional and local registries to find an IP's owner.
  2. Many ISPs use a naming schema that allows you to locate the user. Sometimes you can even read the city name in plain text if you do a reverse-DNS lookup. Sometimes it is more cryptic. For example I currently have p5dcf6c4a.dip.t-dialin.net , and I have no idea that the naming scheme is..
  3. Use a traceroute. If you can't identify the location of a user, you can still find out the location of its uplink

这篇关于IP地址的位置检测技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆