Here is the PHP code snippet to display the ip address and geolocation based on the ip address to the visitors
ÂÂ
Here is the code
<?php
$ip=$_SERVER['REMOTE_ADDR'];
echo "<font face='Verdana' size='3'><b>IP Address= $ip</b>";ÂÂ
$url = "http://www.ipmango.com/api.php?ip=".$ip; $xml = simplexml_load_file($url);
echo "City : {$xml->city} <br />";
echo "Region : {$xml->region} <br />";
echo "Country Name : {$xml->countryname} <br />";
echo "Latitude : {$xml->latitude} <br />";
echo "Longitude : {$xml->longitude} <br />";
?>
Here is the demo

Discussion
No comments for “Get IP And Location using PHP”