how to look up location of ip address in php code example
Example 1: php get location from ip address
$ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
echo $details->city;
Example 2: Find ip address location php
$LocationArray = json_decode( file_get_contents('http://ip-get-geolocation.com/api/json/35.188.125.133'), true);
echo $LocationArray['country'];
echo $LocationArray['city'];
echo $LocationArray['region'];
echo $LocationArray['timezone'];