如何从 IP 地址获知地理位置 [英] How to know Geographic location from an IP address

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

问题描述

我在我的 web 项目的 jsp/servlet 中创建了一个登录应用程序,我想知道访问我的登录页面的不同用户的地理位置.我怎么知道有人从哪里访问我的登录页面?例如:如果一个人从加拿大访问一个页面,那么一条记录将插入到我的数据库中,例如:IP:20.4.9.134 和位置:加拿大.

I have created a login application in jsp/servlet in my web project and I want to know about the geographic locations of different users those access my login page. How can I know that a person is accessing my login page from where? For example: If a person is accessing a page from Canada then a record will be inserted into my database such as : IP: 20.4.9.134 and location: Canada.

推荐答案

我用这个:

http://freegeoip.net/xml/122.169.8.137

或者

http://www.geoplugin.net/xml.gp?ip=xx.xx.xx.xx

简单的调用,它会给你一个包含你需要知道的一切的 xml

Easy call and it throws you an xml with everything you need to know

geoip 的新位置

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

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