Saturday July 4, 2009 @ 11:15:58 GMT+10    ( Weather:  13°C / 55°F  -  N/A )
Home » Weblog Archives

Powered byD's Bloggie
Weblog » Archive » 2007 » May » Day 08 » IP2Country binary database maker
Browse by specific entry ...
 [搞笑+真实]日本动漫中的50样共同点Public upload section cleaning 

Last edited: Wed 2007-05-30 @ 15:58 , by DaRen 2 time(s)

IP2Country binary database maker - 2:48 pm
Now in PHP....
Coding , PHP  -  poster 

Half way through the site updates with lots of new codes and I thought the below script might be useful to some people... so, here you go !

IP2Country binary database maker (PHP)

Note: It's now added to my dev list here, always check there for latest news.

The IP2Country binary database maker in PHP that I written is a port from the original Python script from L. Petersen in Weird Silence, or a direct link to the source code zip file (inside makedb.py file).

The binary database created by this script can be used for IP to country lookup. If you need the script on how to use the database, visit Weird Silence - IP to Country. They have several languages for the implementation (eg. C#, PHP, Python, C, Delphi).

// +----------------------------------------------------------------------+
// | IP2Country binary database maker                                     |
// | Copyright (C) 2007  Darren (http://ahkuan.com/weblog/199.html)       |
// |                                                                      |
// | File    : ip_csv2dat.php                                             |
// | Started : Monday, May 7, 2005                                        |
// | Version : 1.0                                                        |
// +----------------------------------------------------------------------+
// |                                                                      |
// | This is a PHP port with little modification from original            |
// | Python script coded by                                               |
// |        L. Petersen , visit http://weirdsilence.net/software/ip2c/    |
// |                                                                      |
// | What this script does is it converts the CSV database from           |
// | IP-to-Country and GeoIP into binary database for quicker lookup      |
// |                                                                      |
// | Websites:                                                            |
// | IP-to-Country  http://ip-to-country.webhosting.info                  |
// | Maxmind: GeoIP  http://www.maxmind.com/app/ip-location               |
// |                                                                      |
// | Download latest CSV database:                                        |
// | http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip |
// | http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip   |
// |                                                                      |
// | *NOTE*                                                               |
// | Let me know if there is anything wrong with the code, especially     |
// | whether the formatting code used in PHP's pack() function is the     |
// | same as the Python or not. I have no Python coding experience at     |
// | all when I'm porting the original Python script to PHP... so only    |
// | God knows what mistake I've made unless you tell me ;)               |
// |                                                                      |
// | Also, I'm happy to hear if you have any improvements/suggestions.    |
// | Use the 'Contact me' link on my page to contact me.                  |
// |                                                                      |
// +----------------------------------------------------------------------+


Download

  • ip_csv2dat.rar - PHP Source code rarred (CSV database included) (748 KB)
  • ip_csv2dat.zip - PHP Source code zipped (CSV database included) (1 MB)

*Edit 2007.5.9* Added zipped file source code for download
*Edit 2007.5.30* Added to my dev list.
 [搞笑+真实]日本动漫中的50样共同点Public upload section cleaning 

Reader comments ( Add your comments )

1.

Till Fri August 10, 2007 @ 5:41 pm

Awesome!

2.

axaver Sat September 8, 2007 @ 6:29 am

good server 500x


Leave a public comment

Info Note: Neither BBCode nor HTML tags are supported currently.
Why ? Just to make my life easier and keep things simple.
Others: Comments that are longer than 1000 characters will be truncated.

    ) Info

Info

Info


Before you submit... verification

Please enter verification codes as seen in the image above to post your comment.
If you can't read the word, click here
(Your comment will be manually approved by admin before it's displayed to public)

$ view_blog.php 2009.02.28 09:41:16 $
Lost? | XML/HTML sitemap | Contact
38.103.63.57 , 22 queries , 0.117s
Gzip enabled , CSS compressed , JS compressed
Copyright © 2005-2009 Darren's Outpost