PHP code example of psp / ipgeobase

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

    

psp / ipgeobase example snippets


use \GuzzleHttp\Client;
use \PSP\IpGeoBase\IpGeoBase;

$http = new Client();
$geo  = new IpGeoBase($http);

$response = $geo->request('144.206.192.6');

if ($response->getStatus()) {
    echo $response->getCity();
}