View Single Post
Old 04-01-2003, 07:47 AM  
buran
Confirmed User
 
Join Date: Mar 2002
Location: how'd I get here?
Posts: 264
We've been using the database from http://www.ip2country.com

They release updates to the database quarterly, and it's pretty cheap.

As for speed, no it's not slow. You're not scanning through the database, you use the IP address you wish to look up (the first three octects/class C) to generate the offset into the file.

Ie, you fopen the file, then fseek to the byte location determined by:

where IP is A.B.C.D

offset = (a*(256^2)+b*256+c)*2

the final *2 is because the dataset is two characters, the ISO country code (US, UK, DE, etc)

hey Anthony, what's your ICQ? Always good to know more people who know everything. 1240050
__________________
[this signature intentionally left blank]
buran is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote