IP2Country is a PHP class for geo-locating IP addresses using CSV file made available from IP-to-Country and GeoIP. The CSV file contains information like IP range and country info. Below is a partial content inside the CSV file:
"33996344","33996351","GB","GBR","UNITED KINGDOM"
"50331648","69956103","US","USA","UNITED STATES"
"69956104","69956111","BM","BMU","BERMUDA"
CSV file
You can grab either copy of the CSV file:
To speed up searching, Weird Silence came up with a way to convert the data in the CSV file into binary data. They released their source code in Python as well as Windows executable file. Well, that's is just the link to the database builder. To see how to perform IP lookup using the binary databse, you can check out their IP to Country page. They got implementation for C#, PHP, Python, C and Delphi.
I'm not going to release my source code for the lookup part because I believe Weird Silence has already provided well enough information on it. However, you can checkout below my PHP port for their IP2Country binary database maker.
IP2Country binary database maker (PHP)
Written based on their original Python source code to build the binary database. The latest version is v1.0 released on 2007/05/08 under GNU GPL.
- ip_csv2dat.rar - PHP Source code rarred (CSV database included) (748 KB)
- ip_csv2dat.zip - PHP Source code zipped (CSV database included) (1 MB)
Changelog
v1.0 - 2007/05/08 - Public release.
Contact
You can contact me here.
Last update: 2007.05.29