Advertisement
crayawn

PHP GeoIP

May 3rd, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. if(!isset($host) or empty($host)) { $host = $_SERVER['REMOTE_ADDR']; }
  2.                                             $row = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=".$host));
  3.                                             echo('<div class="alert alert-info">'.
  4.                                                     '<b>IP Address: </b>'.$row['geoplugin_request'].'<br />'.
  5.                                                     '<b>City: </b>'.$row['geoplugin_city'].'<br />'.
  6.                                                     '<b>State/Providence: </b>'.$row['geoplugin_regionName'].'<br />'.
  7.                                                     '<b>Area Code: </b>'.$row['geoplugin_areaCode'].'<br />'.
  8.                                                     '<b>Country: </b>'.$row['geoplugin_countryName'].'<br />'.
  9.                                                     '<b>Latitude: </b>'.$row['geoplugin_latitude'].'<br />'.
  10.                                                     '<b>Longitude: </b>'.$row['geoplugin_longitude'].'<br />'.
  11.                                                     '<b>Currency Code: </b>'.$row['geoplugin_currencyCode'].'</div>'
  12.                                                 );
  13.                                         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement