PHP code example of pier-infor / geoliteip

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

    

pier-infor / geoliteip example snippets

 php


namespace Company\MyApp;

use PierInfor\GeoLite\Ip;

error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('date.timezone', 'Europe/Paris');
ini_set('register_globals', 0);
ini_set('opcache.enable', 0);

if (function_exists('opcache_get_configuration')) {
    ini_set('opcache.memory_consumption', 128);
    ini_set('opcache.load_comments', true);
}

'82.66.36.214';
echo 'Scanning ipv6 ' . $ipv6ToCheck . "\n";
echo 'Scanning ipv4 ' . $ipv4ToCheck . "\n";
$geoInst->addIp($ipv6ToCheck);
$geoInst->addIp($ipv4ToCheck);
echo $geoInst->process()->toJson();
unset($geoInst);
 bash
php ./src/app.php