How to get city name based on IP address in java?

后端 未结 3 1729
心在旅途
心在旅途 2020-12-03 16:48

Is it possible to know the city name based on IP address in java?

3条回答
  •  广开言路
    2020-12-03 17:01

    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.

提交回复
热议问题