有什么PHP地理信息库可以推荐吗?
我正在开发一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
地理IP怎么样? http://us.php.net/manual/en/book.geoip.php
How about Geo IP? http://us.php.net/manual/en/book.geoip.php
该库的一些提供程序具有基于 IP 的地理编码接口:https://github.com/willdurand/Geocoder
This library has some providers that have IP based geocoding interfaces: https://github.com/willdurand/Geocoder
从 Google 地图文档读取:
Reading from the Google Map Documentation:
更多...
对于我的访客地图,我设置了一个 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.
我已经使用 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 :)