-->

IP localization: mapping ip->location fixed over t

2019-07-15 20:20发布

问题:

I'm administering a web platform and want to get some statistical data, where my users come from. I can store the remote IP and I know that there are localization services that map an IP to a geolocation.

How is this mapping done? Are there fixed tables, which IP address was given to which region?

Must I request the mapping in the moment of the access or can I request it days/months/years later? In other words: Is the mapping from IP to location fixed or does it change over time?

回答1:

The mapping from IP to location change over time. I have read that the databases change 5% each month, even though its hard to know if they really change that much or if the database providers lie to sell their updates more often. But its a fact that these databases change. So you should obtain the location of an IP address asap, at least not later that a month after you captured the IP address.



回答2:

In case you want to store the demographic data, you should save the country information retrieved instead of IP address, due to the nature it may changes from time to time.



回答3:

You can use third party sites to gelocalize ip.

I usually use:

https://www.geo-ip.net/locate?query=stackoverflow.com&format=json