Is it possible to know the city name based on IP address in java?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
If an online API as the others have suggested won't suit your application, I have previously successfully used MaxMind GeoLite City, which comes with a Java API (among many others). Just download the database files, point your API code at them, and off you go. Simple and straightforward.
You have to use a service such as hostip.info that maps an IP to its physical location, and offer an API to developers to simplify the task.
There are many other services, paid and for free, that you can find at Google.
are you using jsp or what ? for city name over client side you can use google's API which will return you the geographical details of the user mapped with the IP. As google's documentation say you can get the following
When populated, the google.loader.ClientLocation object is populated with the following metro-level granularity properties:
for further reference see the complete documentation at http://code.google.com/apis/ajax/documentation/