Geolocation IP in Java [closed]

ぐ巨炮叔叔 提交于 2019-12-02 06:34:29

All you need is GeoIP, provided by MaxMind company.

They provide free GeoIP2 database - GeoLite2 and several GeoIP2 APIs(thanks karel) including Java API to read database file too.

Before GeoIP2, there was GeoIP, now they called it GeoIP Lecacy, Free databases and downloadable Java library from maven.org or from github are still available.

GeoIP Lecacy maybe dead in the future, however, for now, because GeoIP2 doesn't provide Java API to read the database information (such as GEO-533LITE 20150303 Build 1 Copyright (c) 2015 MaxMind Inc All Rights Reserved), so I still use it in my website. I use GeoIP2 in my IRC bot to benefit from the multiple language feature of GeoIP2.

Each country has a few range of IPs.

I'm not aware of a Java implementation of that, but you could use the output from http://services.ce3c.be/ciprg/ and create your own code that gives the country based upon the IP address.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!