YOUR ClientID, Password and APIKey //you can register for free at mapquest.com TMapQuestAPI = class private fClientID : string; fPassword : string; fAPIKey : string; fURL : string; protected function getXML:string; virtual; abstract; procedure parseResponse(response:TStringList); virtual; abstract; public constructor Create; function getFromMapQuest(enableLogging:boolean):boolean; property ClientID : string read fClientID write fClientID; property Password : string read fPassword write fPassword; property APIKey : string read fAPIKey write fAPIKey; property URL : string read fURL; end; TReturnedAddyList=class; //this descendant will implement the GeoCoder functionality from mapquest //you must comply with mapquests terms of service, check mapquest.com to make sure //that works for you TMapQuestGeoCoder = class(TMapQuestAPI) private fAddress : string; fState : string; fCity : string; fCountry : string; fPostalCode: string; fCounty : string; fReturnedAddresses : TReturnedAddyList; protected function getXML:string; override; procedure parseResponse(response:TStringList); override; procedure ClearReturnedAddys; public constructor Create; destructor Done; property Address:string read fAddress write fAddress; property City:string read fCity write fCity; property State:string read fState write fState; property Country:string read fCountry write fCountry; property PostalCode:string read fPostalCode write fPostalCode; property County:string read fCounty write fCounty; property ReturnedAddresses:TReturnedAddyList read fReturnedAddresses; end; //container class for a returned address TReturnedAddy = class public Address, City, State, PostalCode, Country, County, Lat, Long : string; constructor Create(aAddress, aCity, aState, aPostalCode, aCountry, aCounty, aLat, aLong:string); end; //you can get back MULTIPLE addresses if you send in something that is generic enough //in that case, the COUNT will be > 1. Make sure you implement a resolver screen to handle this TReturnedAddyList = class(TList) protected property Items; property List; public function getAddy(index:integer):TReturnedAddy; property Address[Index:Integer]:TReturnedAddy read getAddy; end;implementationuses sysutils, dialogs, IdHttp, IdSSLOpenSSL, IdResourceStringsCore, IdLogFile, xdom_3_2;const CR = #13; LF = #10; EOL = CR+LF; xmlEOL = EOL;type // this is a descendant of TidLogFile, it will create a plain text file with // information about the transfer session TlogFile = class(TidLogFile) protected procedure LogReceivedData(const AText, AData: string); override; procedure LogSentData(const AText, AData: string); override; procedure LogStatus(const AText: string); override; public procedure LogwriteString(const AText: string); override; class function buildLogLine(data, prefix: string) : string; end;// this ensures the output of error and debug logs are in the same format, regardless of sourceclass function TlogFile.buildLogLine(data, prefix: string) : string;begin data := StringReplace(data, EOL, RSLogEOL, [rfReplaceAll]); data := StringReplace(data, CR, RSLogCR, [rfReplaceAll]); data := StringReplace(data, LF, RSLogLF, [rfReplaceAll]); result := FormatDateTime('yy/mm/dd hh:nn:ss', now) + ' '; if (prefix <> '') then result := result + prefix + ' '; result := result + data + EOL;end;// ---------------------------------------------------------------------------procedure TlogFile.LogReceivedData(const AText, AData: string);begin // ignore AText as it contains the date/time LogwriteString(buildLogLine(Adata, '<<'));end;// ---------------------------------------------------------------------------procedure TlogFile.LogSentData(const AText, AData: string);begin // ignore AText as it contains the date/time LogwriteString(buildLogLine(Adata, '>>'));end;// ---------------------------------------------------------------------------procedure TlogFile.LogStatus(const AText: string);begin LogwriteString(buildLogLine(AText, '**'));end;// ---------------------------------------------------------------------------procedure TlogFile.LogwriteString(const AText: string);begin // protected --> public inherited;end;// ---------------------------------------------------------------------------{ TMapQuestAPI }//create the class, default everything to blankconstructor TMapQuestAPI.Create;beginfURL:='';fClientID:='';fPassword:='';fAPIKey:='';end;// ---------------------------------------------------------------------------//send the http post to mapquest and return a stringlist with the results (or nil if error)function TMapQuestAPI.getFromMapQuest(enableLogging:boolean): boolean;const logFileName = 'http.log';var plainData : TStringList; HTTP : TidHTTP; response : TStringList; logFile : TLogFile; //as mentioned in my article on http post for DHL, indy converts CR/LF pairs to &. //This causes a problem