PHP Classes
Icontem

File: sample-IP2Location.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of KL Liew  >  IP2Location  >  sample-IP2Location.php  
File: sample-IP2Location.php
Role: Example script
Content type: text/plain
Description: Sample PHP Code
Class: IP2Location
Lookup the geographic location of an IP address
 

Contents

Class file image Download
#!/usr/bin/php -q
<?php

//
// This code demonstrates how to use to IP2Location BIN database to lookup
// country, region, city, isp, latitude, longitude, domain, zip code
//
// Note: Only Country information will be displayed if the BIN database is IP-COUNTRY.BIN
//
// Copyright (C) 2006 IP2Location.com  All Rights Reserved.
//

include("IP2Location.inc");

$ip IP2Location_open("samples/IP-COUNTRY-SAMPLE.BIN"IP2LOCATION_STANDARD);

$record IP2Location_get_all($ip"35.1.1.1");

echo 
"\$record->country_short : " $record->country_short "<br>";
echo 
"\$record->country_long : " $record->country_long "<br>";
echo 
"\$record->region : " $record->region "<br>";
echo 
"\$record->city : " $record->city "<br>";
echo 
"\$record->isp : " $record->isp "<br>";
echo 
"\$record->latitude : " $record->latitude "<br>";
echo 
"\$record->longitude : " $record->longitude "<br>";
echo 
"\$record->domain : " $record->domain "<br>";
echo 
"\$record->zipcode : " $record->zipcode "<br>";
echo 
"\$record->timezone : " $record->timezone "<br>";
echo 
"\$record->netspeed : " $record->netspeed "<br>";
echo 
"\$record->ipaddr : " $record->ipaddr "<br>";
echo 
"\$record->ipno : " $record->ipno "<br>";

IP2Location_close($ip);

?>
<P><A href="http://www.ip2location.com"><img border=0 src="http://www.ip2location.com/images/ip2location468x60_0.gif"></a></P>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products