我正在查询地理数据库(城市,国家,组织)的一堆IP地址。 我看着http://www.maxmind.com/download/geoip/api/pascal/Sample.pas和修改了它:德尔菲Maxmind geoip查询
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;
,但我得到超过50000查询没有结果。 我知道在使用csv时必须处理地址,但我有二进制db版本。 我错过了什么?
谢谢!
什么返回你'GeoIP.GetDatabaseInfo'? – TLama 2012-08-13 13:36:43
不幸的是:http://s13.postimage.org/r0ihjezev/geoipdbinfo.png – asg2012 2012-08-13 13:42:35
而且你有德尔福2009+和使用['a unit'](http://www.maxmind.com/download/geoip/api /pascal/GeoIP.pas)是在Delphi版本之前创建的。所以它看起来像是ANSI/Unicode不匹配。 – TLama 2012-08-13 13:45:46