Skip to content

Latest commit

 

History

History
19 lines (11 loc) · 849 Bytes

README.md

File metadata and controls

19 lines (11 loc) · 849 Bytes

Ip2Country

PHP class and .csv file that helps to get the location of an ip extremely fast

Ip2Country.php converts the .csv file to PHP arrays and manage to get the location.

Run the file example.php

$i->parseCSV2(); this function parse the .csv into PHP arrays, just run it once.

Update (04.02.2010): Function parseCSV() is storing over 99 000 entries in a memory table before saving to files. Each table entry in PHP is taking a lot of space, so the script needs more than 40 MB of RAM. So I added the parseCSV2() function, which does exactly the same, but requires less than 1 MB of RAM. New function is a bit slower, as it is doing more disk operations.

You can get the updates from the .csv file here: http://software77.net/geo-ip/

Source of the code: http://de77.com/php/how-to-detect-visitors-country-using-his-ip-address