1//You can use an api:
2//Link to documentation: https://ip-get-geolocation.com/documentation/
3
4$LocationArray = json_decode( file_get_contents('http://ip-get-geolocation.com/api/json/35.188.125.133'), true);
5
6echo $LocationArray['country'];
7echo $LocationArray['city'];
8echo $LocationArray['region'];
9echo $LocationArray['timezone'];