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 地址获知地理位置
基础教程推荐
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 大摇大摆的枚举 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
