IP to country conversion

Today I found that IP Address Locator, which returns localized information based on the client\’s IP address [1]. A non-commersial version based on PHP is written by Mika Tuupola [2] and is easy installable via PEAR:

pear install http://www.appelsiini.net/~tuupola/php/download/I18N_IP2Country-0.2.0.tgz

The relation between the IP and the country is constructed via information [3] put into a database:

CREATE TABLE ip2country (
ipfrom INTEGER UNSIGNED,
ipto INTEGER UNSIGNED,
code CHAR(2),
country VARCHAR(64)
);

[1] http://www.geobytes.com/IpLocator.htm?GetLocation
[2] http://www.appelsiini.net/~tuupola/php/I18N_IP2Country/docs/
[3] http://www.ip-to-country.directi.com/latest/ip-to-country.csv.zip

Leave a Reply