How to obtain the province and city corresponding to the IP address by Java request

preface

In a recent project, users in different provinces need to display different contents, so you need to obtain the IP address through request, and then obtain the IP corresponding province through IP.

The operation steps here are:

1. Obtain IP through request

2. Obtain the corresponding provinces and cities through IP

3. Display the content by comparing the set province with the corresponding IP province

Obtain IP through request

You can refer to my other article [Java obtains IP address through request] and the code is as follows:

The official download address is【 http://dev.maxmind.com/geoip/geoip2/geolite2/ 】

The local download address is【 http://xiazai.jb51.net/201710/yuanma/GeoLite2-City_20171003 (jb51.net). rar】

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>