PHP code example of riteshptl21 / geoip

1. Go to this page and download the library: Download riteshptl21/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/ */

    

riteshptl21 / geoip example snippets


'Riteshptl21\Geoip\GeoipServiceProvider'

$location = Geoip::getLocation();

$location = Geoip::getLocation( '2.24.234.19' );

array (
    "ip"            => "127.0.0.0",
    "isoCode"       => "IN",
    "country"       => "India",
    "city"          => "Ahmedabad",
    "state_code"    => "GJ",
    "postal_code"   => "261201",
    "lat"           => 23.0333,
    "lon"           => 72.6167,
    "timezone"      => "Asia/Kolkata",
    "continent"     => "AS",
    "default"       => true
)