|Ratings|| ||Unique User Downloads|| ||Download Rankings|
|Not enough user ratings||Total: 655 ||All time: 4,886 This week: 189|
This class can get the location of an IP from a Web service.
It can send HTTP requests to the Web server of a geo-location API to get the location of a given IP address either at country or city level.
The default configuration is set to retrieve the location using the ipinfodb Web service. The location results are returned as an array.
CodeIgniter Geolocation Library
CodeIgniter Geolocation library allows you to locate an IP Address using "ipinfodb" API.
CodeIgniter Versoin >= 2.x.x
Copy the file
config/geolocation.php to the
Copy the file
libraries/geolocation.php to the
You need to subscribe to http://ipinfodb.com/register.php to get your API KEY and then,
application/config/geolocation.php and put it there :
$config['api_key'] = 'YOUR_API_KEY';
After that, you can call the library within your controller for instance like following :
$config = $this->config->config['geolocation'];
$this->geolocation->set_ip_address($ip); // IP to locate
// OR you can change the format within `config/geolocation.php` config file
$country = $this->geolocation->get_country();
// For more precision
$city = $this->geolocation->get_city();
if($city === FALSE)
You can change the result format within the config file,
or leave it empty to return a PHP Array
$config['format'] = 'json'; // available format : xml|raw|json or empty for php array
IpInfoDb API :
For more information about the API please visit : http://ipinfodb.com
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.