IP2Location.com

IP2Location.com library

IP2Location.com is a premium geo service with regular updates to their IP database. You may purchase either their "IP to country" database that can be uploaded to your site, or web service credits.

IP to country database

"IP to country" database comes with 2 files: one for IPv4 and another one for IPv6 addresses. You must upload them to "application/libraries/geolocation/ip2location/db" folder on your site and rename them to "countries.bin" (for IPv4) and "countries6.bin" (for IPv6) respectively. You will end up with these files:

  • application/libraries/geolocation/ip2location/db/countries.bin
  • application/libraries/geolocation/ip2location/db/countries6.bin

Once uploaded, you must set "lookup method" setting to "local database".

Web service

This method allows the system to detect user's location by using IP2Location's web service. You must insert your API key into the appropriate text box on the settings page and set "lookup method" setting to "web service". Software caches all requests to minimize your credits usage and enhance performance.

Using both methods

You may use both of the above methods for better accuracy and failover if you prefer. Simply set "lookup method" setting to either "local database + web service" or "web service + local database" depending on the order you would like the system to follow. For example if you set "local database + web service" system will try to look up user's IP address in the local database first, and if not found it will make a request using web service method.