I'm looking to query the geoip database (city, country, org) for a bunch of IP addresses. I looked at http://www.maxmind.com/download/geoip/api/pascal/Sample.pas and modified it:
function LookupCountry(IPAddr: string) : string;
var
GeoIP: TGeoIP;
GeoIPCountry: TGeoIPCountry;
begin
GeoIP := TGeoIP.Create('C:\Users\Albert\Documents\RAD Studio\Projects\Parser\geoip\GeoIP.dat');
try
if GeoIP.GetCountry(IPAddr, GeoIPCountry) = GEOIP_SUCCESS then
begin
Result := GeoIPCountry.CountryName;
end
else
begin
Result := IPAddr;
end;
finally
GeoIP.Free;
end;
end;
but I get no results on over 50'000 queries. I know that the address has to be manipulated when working with csv, but I have the binary db version. What am I missing?
Thanks!