Jump to content

Advance IP info using PHP


depojones

Recommended Posts

ok you would have to have ur db filled with ip and locations ect... so a quick way is to use anouther site and pull there results like so

 

<?
$ip = '59.93.196.219';
$url = "http://www.ipmango.com/api.php?ip=".$ip;
$xml = simplexml_load_file($url);
echo "IP address : {$xml->ipaddress} <br />";
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 />";
?>

For the ip address use

 

$_SERVER['REMOTE_ADDR']

 

For the city there no function for that. You will have to find a database make a script for it.

 

MaxMind have a nice database of IP address with ISP/City/Latitude-Longitude/...

http://www.maxmind.com/app/ip-locate

 

or you can ask google maybe someone made a API or offer a service for that

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.