How to know Geographic location from an IP address(如何从 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 地址获知地理位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何从 IP 地址获知地理位置
基础教程推荐
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 降序排序:Java Map 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01