PHP code example of faridbabayev / geoip

1. Go to this page and download the library: Download faridbabayev/geoip library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

faridbabayev / geoip example snippets


$geoip = new Geoip();
$geoip->ip;  //return ip address
$geoip->country_code;  // return country code
$geoip->country_name;  // return country name
$geoip->region_code;  // return region code
$geoip->city;  // return city
$geoip->zip_code;  // return zip_code
$geoip->time_zone;  // return time zone
$geoip->latitude;  // return latitude 
$geoip->metro_code;  // return metro_code  

$geoip = new Geoip();
$geoip->for('75.197.224.3');
$geoip->country_code;  // return country code