17 April 2013

import GeoIP csv to MySQL DB provided by MaxMind

you can download GeoIP csv database from http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip

unzip  and extract the csv file just upload it your web server

$ips=explode("\n",file_get_contents('GeoIPCountryWhois.csv'));
foreach($ips as $ip)
{
$ip=str_replace('"',"'",$ip); //this variable cantains sample string '1.0.0.0','1.0.0.255','16777216','16777471','AU','Australia'   which means you can use this string directly in mysql insert query







//perform your mysql insert query here

}


that is all :))

No comments:

Post a Comment