PHP code example of manzadey / sypexgeo

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

    

manzadey / sypexgeo example snippets


use Manzadey\SypexGeo\SxGeo;

$sxGeo = new SxGeo('sxGeo.dat');

$country = $sxGeo->getCountry($ip); // returns a two-digit ISO country code
$sxGeo->getCountryId($ip);          // returns the country number

$sxGeo->getCity($ip);                 // returns brief information, without the name of the region, country and time zone
$sxGeo->getCityFull($ip);             // returns full information about the city, region and country
$city = $sxGeo->get($ip);             // executes getCountry or getCity depending on the type of database
$cityName = $sxGeo->getCityName($ip); // returns the name of the city