Skip to content Skip to sidebar Skip to footer
Reading Time: < 1 minute

PHP get visitor details without any third party web site registrations or keys.Get visitor IP address,region,latitude,longitude,Country,visitor map with php.Look at this example you can get visitor all details even latitude,longitude and country details.

First you must create a folder named “cache” and put folder permission as 0777.

// Get visitor IP address
$ip = $_SERVER['REMOTE_ADDR'];
// remember chmod 0777 for folder 'cache' folder
$file = "cache/".$ip;
if(!file_exists($file)) {
    // request as jason
    $json = file_get_contents("http://api.easyjquery.com/ips/?ip=".$ip."&full=true");
    $f = fopen($file,"w+");
    fwrite($f,$json);
    fclose($f);
} else {
    $json = file_get_contents($file);
}
$json = json_decode($json,true);
print_r($json); // Array

Display results;

echo $location['countryName']; // Country
echo $location['latitude']  // Latitude

View Demo Visitor details