Use Maxmind Free GeoLiteCountry for geo targeting visitors (example)

So, I should put it here for my personal notes, in case I lost my notes.
Maxmind provide us, developer, a free geo IP country database. This database is useful for geo targeting visitors. For example you can show special message for visitors coming from certain country or maybe blocking visitors that coming from certain country. Ads targeting is also one of it’s usage.
Here’s step by step guide for Maxmind GeoLiteCountry :

Sample PHP code usage:

Notes: this free database is updated monthly. Usually every first week of each month, so make sure you download the latest GeoIP.dat.gz file.

updated: Maxmind’s has been moved to github (didn’t realize it before)

  1. mohamed laouane

    thank you so much , it was simple and easy to do it

    useful article like always , thanks again


  2. php: detecting visitor’s real IP address - pingback on 2014/09/05 at 18:22

Leave a Reply

Trackbacks and Pingbacks:

%d bloggers like this: