Wednesday, 21 December 2011

How can track Ip address in php

Here with the help of APPs you can track the ip.
These details include Geographic location information (includes country, region/state, city, latitude, longitude and telephone area code.), 

<?php
 $ip=$_SERVER["REMOTE_ADDR"];
$handle = fopen("http://api.ipinfodb.com/v3/ip-city/?key=5b32848aa72361c4efdef63111d6e3d9247e076891f5248eec0a5be1208993e6&ip=".$ip, 'r');
$tt=fgets($handle, 4096);
echo '<br>';
list($statusCode, $statusMessage, $ipAddress,$countryCode,$countryName,$regionName,$cityName,$zipCode,$latitude,$longitude,$timeZone) = split(';', $tt);
echo "Ip-Address->".$ipAddress;
echo '<br>';
echo "Country Name->".$countryName;
echo '<br>';
echo "Country Code->".str_ireplace('-', '', $countryCode);
echo '<br>';
echo "City Name->".str_ireplace('-', '', $cityName);
fclose($handle);

No comments:

Post a Comment