get user location from 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; // -> "Mountain View"
Example 2: php get user ip
$ip = $_SERVER['REMOTE_ADDR'];