Feb
22
Where are your users from, part 2
February 22, 2010 | 1 Comment

Recently, I wrote about geolocalisation of your users/visitors based on the IP to Country table. After using it for a couple of months, I found it painful to have to regularly update the table (even if some people came up with an automatic work around based on PERL scripts for example).
So, I decided to find another way to solve the problem and gave the GeoIP Apache module by MaxMind a try. The installation is as simple as can be:
1 2 3 | aptitude install libapache2-mod-geoip a2enmod geoip /etc/init.d/apache2 restart |
Once the module is setup, you can use the following PHP code to obtain the Country Code (2 letters)
1 | $countryCode == $_SERVER["GEOIP_COUNTRY_CODE"]; |
Finally, here is a list of country codes and the associated country names.
If yo
That’s it, quick and simple.
Comments
1 Comment so far
New blog post: Where are your users from, part 2:
Recently, I wrote about geolocalisation of your users/visitors … http://bit.ly/9um21T