有什么PHP地理信息库可以推荐吗?

发布于 2024-09-27 07:58:53 字数 124 浏览 3 评论 0原文

我正在开发一个 PHP 应用程序,它应该根据访问者的 IP 地址在世界地图中显示他们。

您是否尝试/使用过 PHP 中的任何地理信息库?有什么可以将 IP 地址转换为地理信息的东西吗?如果是这样,请分享您的经验和建议。

I'm woking on a PHP app that should show visitors in a world map, base on their ip-addresses.

Have you tried/used any geo-information library in PHP? Something that can convert ip-addresses into geo-information? If so, please share your experience and recommendations.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

千秋岁 2024-10-04 07:58:53

该库的一些提供程序具有基于 IP 的地理编码接口:https://github.com/willdurand/Geocoder

This library has some providers that have IP based geocoding interfaces: https://github.com/willdurand/Geocoder

决绝 2024-10-04 07:58:53

Google 地图文档读取:

作为用户的IP地址只能
提供对用户的粗略估计
位置,我们不建议使用
这种地理定位方法。万维网联盟
方法是最简单也是最有效的
完全支持所以应该是
优先于其他方法。

目前,有多种方法可以
检测用户在某个范围内的位置
浏览器。这些方法都不是
Google 地图 API 的一部分;反而,
它们是通用的行业标准。
较新的浏览器开始支持
W3C 地理定位标准。这
标准是 HTML5 的一部分,并将
可能成为事实上的标准
继续前进。所有应用程序
希望执行地理定位应该
支持这个标准。一些浏览器
与 Google Gears 可以使用 Google Gears
地理定位 API。自从广泛流传以来
仍然支持 W3C 标准
即将推出,检查 Gears 是
良好的后备机制。一些浏览器
使用IP地址来检测用户的
位置,尽管这仅提供了一个
非常粗略的估计。

Reading from the Google Map Documentation:

As a user's IP address can only
provide a rough estimate of a user's
location, we don't recommend using
this approach for geolocation. The W3C
approach is the easiest and most
fully-supported so it should be
prioritized over other methods.

Currently, several ways exist to
detect the user's location within a
browser. None of these methods are
part of the Google Maps API; instead,
they are common industry standards.
Newer browsers are starting to support
the W3C Geolocation standard. This
standard is part of HTML5 and will
likely become the de-facto standard
going forward. All applications that
wish to perform geolocation should
support this standard. Some browsers
with Google Gears can use Google Gears
Geolocation API. Since widespread
support for the W3C standard is still
forthcoming, checking for Gears is a
good fallback mechanism. Some browsers
use IP addresses to detect a user's
location, though this provides only a
very rough estimate.

傲世九天 2024-10-04 07:58:53

更多...

对于我的访客地图,我设置了一个 Google Fusion 表。我执行 MaxMind 查找并添加日期、时间、IP、纬度和经度。使用 PHP 到表中。 Fusion 表可以在 GUI 中进行映射,新的 Google Maps V3 API 支持传递 Fusion 表 ID 和 SELECT 查询,以便地图根据您的规范进行绘制。我将主数据库设为私有,然后创建了一个仅显示纬度和经度的公共视图,以便 Google 地图 API 不需要通过 Google 进行身份验证即可绘制地图。

我用它在我的网站上制作访客地图。我本周刚刚实施了访客地图。我已将所有代码打包,以便可以将其部署在几乎任何支持 PHP 和 CURL 的服务器上。如果您有兴趣,请给我发送电子邮件至 jkirby(at)drinkcocaine(dot)com。

您可以在 www(dot)drinkcocaine.c(dot)com 上查看我的地图。

More...

For my visitor map, I setup a Google Fusion table. I do the MaxMind lookup and add the date, time, IP, lat., and lon. to the table using PHP. Fusion tables can do mapping in the GUI and the new Google Maps V3 API supports passing a Fusion Table ID and SELECT query so the map draws using your specifications. I made my main database private and then created a public view that only displays lat and long so that the Google Maps API does not need to authenticate with Google to draw the map.

I use it to make the visitor map on my website. I just implemented the visitor map this week. I have all of the code packaged up so that it can be deployed on nearly any server that supports PHP and CURL. Soot me an email to jkirby(at)drinkcocaine(dot)com if you are interested.

You can see my map at www(dot)drinkcocaine.c(dot)com.

还在原地等你 2024-10-04 07:58:53

我已经使用 http://www.maxmind.com 一年多了,我非常高兴。它可以免费定位到城市。如果您支付服务费用,它可以更进一步地工作并报告 ISP 和组织数据。我支付服务费用。我支付了 50 万次查找费用,但还剩下 36.5 万次(差不多两年后)。我将它与 Google 地图结合使用来绘制访客地图。大约需要 10 行(或更少)PHP 代码来进行查询并获取信息。

您还可以下载免费数据库并在您的服务器上使用它们(每月提供更新)。它们附带了进行查找所需的所有 PHP 代码。您也可以在本地安装付费版本。

我希望有一个 $_SERVER[W3C_LOCATION] do-hicky :)

I have been using http://www.maxmind.com for over a year now and I am very pleased. It can locate down to the city for free. It can works it's way down even closer and report ISP and organization data if you pay for the service. I pay for the service. I paid for 500K lookups and I still have like 365K left (after almost two years now). I use it for visitor mapping in conjunction with Google maps. It takes about 10 lines (or less) of PHP code to make the query and get information back.

You can also download the free databases and use them on your server (updates available each month). They come with all the PHP code required to do the lookups. You can also install the paid version locally.

I wish there was a $_SERVER[W3C_LOCATION] do-hicky :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文