Q: Put viewers location on my site I'd like to put the location of the viewer on my website. 
EXAMPLE:
The viewer lives in "Sydney, NSW, Australia", so on the site it says "Sydney, NSW, Australia"
or
The viewer lives in "Washington, DC, United States", so on the site it says "Washington, DC, United States"

A: Check Live form here- http://uposonghar.com/personal/ip/
Use this to get user country by their IP-
<?PHP
function visitor_country()
{
$client  = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote  = $_SERVER['REMOTE_ADDR'];
$result  = "Unknown";
if(filter_var($client, FILTER_VALIDATE_IP))
{
    $ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
    $ip = $forward;
}
else
{
    $ip = $remote;
}

$ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip));

if($ip_data && $ip_data->geoplugin_countryName != null)
{
    $result = $ip_data->geoplugin_countryName;
}

return $result;
}

echo visitor_country(); // Output Coutry name [Ex: United States]
?>

