PHP Classes

Get a country from an ip address: I need to get the country of an ip address

Recommend this page to a friend!
  All requests RSS feed  >  Get a country from an ip address  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Get a country from an ip address


Picture of hermann akue by hermann akue - 7 years ago (2015-11-17)

I need to get the country of an ip address

This request is clear and relevant.
This request is not clear or is not relevant.


I need to get the country of an ip address. But i don't want to use an online service for that

Ask clarification

1 Recommendation

Process MaxMind Countries, Regions and Cities Files: Extract MaxMind geographic data into a database

This recommendation solves the problem.
This recommendation does not solve the problem.


Picture of Dave Smith by Dave Smith Reputation 6845 - 7 years ago (2015-11-17) Comment

No online service requirement means that you have to download and store the information locally. This is the most recent package I was able to find on here that uses a free data set available from maxMind. There is a newer version of the data set available and I do not know if this package is compatible with it or not, however the data set used by this package does still seem to be available as well.

  • 1. Picture of Axel Hahn by Axel Hahn - 7 years ago (2015-11-30) Reply

    As additional information: Also based on Maxminds database are the solutions - PECL Geoip (a php module) - mod_geoip (a webserver module for Apache httpd; something similiar exists for Nginx too)

  • 2. Picture of Nadir Latif by Nadir Latif - 7 years ago (2015-12-06) in reply to comment 1 by Axel Hahn Reply

    I used Maxmind's GeoLite2 Country database recently. Its a good option for getting the country code from an ip. Its free. They also provide an update script for the database that you can run as a cron job.

Recommend package