Привет,
Код
<?php
if (isset($_GET['ip']))
{
     error_reporting(0);
    $ip = $_GET['ip'];
    $LongIP = ip2long($ip);
    $IPFile = file_get_contents("GeoIPCountryWhois.csv");
    $convert = explode("\n", $IPFile); //create array separate by new line
    $country = "";
    for ($i=0; $i < count($convert); $i++) 
    {
     $line = $convert[$i];
     $line = str_replace('"', '', $line);     
     $line = explode(',', $line);
       
     $IPLOW = $line[2];
     $IPHIGH = $line[3];
     $country = $line[4];
     if($LongIP >= $IPLOW && $LongIP <= $IPHIGH){ break; }
    }
    echo $country;
}
?>
http://falcopartners.com/countries/GeoIPCountryWhois.csv