PHP Classes

phpIP2Country: Determine the country of an IP in a database

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,196 All time: 3,169 This week: 455Up
Version License Categories
phpip2country 1.0GNU General Publi...Databases, Geography
Description 

Author

This class can be used to determine the country of a given IP searching in an IP range database.

It accesses a SQL database that has a table with the countries associated to each known IP range.

The IP address to check is searched to determine which IP range it belongs. If its IP range is found, the class returns the associated country code.

The IP ranges database table can be populated with separate script from IP range file in CVS format that can be obtained from the IP to country service site.

Picture of Mike Leigh
Name: Mike Leigh <contact>
Classes: 7 packages by
Country: United Kingdom
Age: 47
All time rank: 19312 in United Kingdom
Week rank: 44 Up4 in United Kingdom Up

Details

#==============================================================================# +---------------------------------------+ | phpIP2Country - IP Address to Country | +---------------------------------------+ Author : Mike Leigh Email : mike@mikeleigh.com Website : http://www.mikeleigh.com/scripts/phpip2country Support : http://www.mikeleigh.com/forum Licence : GNU GPL - see LICENCE file Version : 0.1 phpIP2Country is a IP address to Country lookup system. Incorporating phpIP2Country into your application is as simple as including the class file like so: include('path/to/ip2country.class.php'); For installation instructions see the INSTALL file. For license details see the LICENSE file. For development history see the CHANGELOG file. #==============================================================================#

  Files folder image Files (7)  
File Role Description
Accessible without login Plain text file CHANGELOG Doc. Change Log
Plain text file ip2country.class.php Class phpIP2Country Main Class
Accessible without login Plain text file test.ip2country.class.php Example Example Usage
Accessible without login Plain text file populate_database.php Aux. Script to populate the database with the CSV Data
Accessible without login Plain text file LICENCE Lic. License File
Accessible without login Plain text file INSTALL Doc. Installation
Accessible without login Plain text file README Doc. Readme

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
Downloadphpip2country-2007-02-20.zip 9KB
Downloadphpip2country-2007-02-20.tar.gz 8KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
phpDB Download .zip .tar.gz Communication with the Database Required
phpCSV Download .zip .tar.gz Required to read the IP CSV Data feed Required
phpFile Download .zip .tar.gz Used to access the filesystem Required
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,196
This week:0
All time:3,169
This week:455Up