PHP code example of ayesh / geo-ip
1. Go to this page and download the library: Download ayesh/geo-ip 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/ */
ayesh / geo-ip example snippets
use Ayesh\GeoIP\GeoIPLookup;
$geoip = GeoIPLookup::createFromDefaultDatabase();
$geoip->lookup('8.8.8.8'); // "US"
$geoip->lookup('123.19.12.50'); // "VN"
use Ayesh\GeoIP\GeoIPLookup;
$geoip = new GeoIPLookup('path/to/json/directory');
$geoip->lookup('8.8.8.8'); // "US"
$geoip->lookup('123.19.12.50'); // "VN"