1. Go to this page and download the library: Download timeshow/ip-location 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/ */
timeshow / ip-location example snippets
use TimeShow\IpLocation\IpLocation;
$ipLocation = new IpLocation();
$ipLocation->getLocation('X.X.X.X');
$ipLocation->getArea('X.X.X.X');
$ipLocation->getCountry('X.X.X.X');
$ipLocation->getProvince('X.X.X.X');
$ipLocation->getCity('X.X.X.X');
$ipLocation->getCounty('X.X.X.X');
$ipLocation->getISP('X.X.X.X');
$ipLocation = new IpLocation();
$location = $ipLocation->getLocation('X.X.X.X');
mb_convert_encoding($location, "UTF-8", "gbk");