Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

TWetGMaps - call a HTTP/HTTPS get virtual function

 Post Reply Post Reply
Author
Schwenk Peter View Drop Down
New Member
New Member
Avatar

Joined: 13 May 2015
Posts: 12
Post Options Post Options   Quote Schwenk Peter Quote  Post ReplyReply Direct Link To This Post Topic: TWetGMaps - call a HTTP/HTTPS get virtual function
    Posted: 09 Jun 2015 at 11:25pm
Having the TWebGMaps and TWebGMapsGeocoding virtual function for making the HTTP/HTTPS API calls would be nice to have.  Obviously not everyone may want to use Indy for HTTP but for those of us who do, this would be nice for the reasons noted in the following example comments...

{code}
function TTheAPIComponent.HttpsGet(Url: string): string; override;
var
  IdHttp: TIdHTTP;
  IdHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
  Result := '';
  IdHTTP := TIdHTTP.Create(nil);
  IdHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  try
    IdHandler.SSLOptions.RootCertFile := '';
    IdHandler.SSLOptions.KeyFile := '';
    IdHandler.SSLOptions.CertFile := '';
    IdHandler.SSLOptions.Method := sslvSSLv23;
    IdHandler.SSLOptions.VerifyMode := [];
    IdHandler.SSLOptions.VerifyDepth := 0;
    IdHttp.IOHandler := IdHandler;
    IdHttp.HandleRedirects := True;
    { allow use of HTTPS for using API key on URL }
    if UseHTTPS then
      Url := ReWriteURLForHTTPS(Url);
    { allow passing API key on URL for Google counters to work }
    if Trim(APIKey) <> '' then
      Url := AppendAPIKeyToURL(Url)
    { allow use for Google Maps for Work Client ID & Signature }
    else if Trim(ClientID) <> '' then
      Url := AppendClientIDToURL(Url);
    { allow for local logging of API calls in application }
    if Assigned(FOnHttpsGet) then
      FOnHttpsGet(Url);
    Result := IdHttp.Get(Url);
  finally
    FreeAndNil(IdHandler);
    FreeAndNil(IdHttp);
  end;
end;
{code}



Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8398
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 15 Jun 2015 at 12:30pm
Thanks. We'll consider this for a future update.
Back to Top
Schwenk Peter View Drop Down
New Member
New Member
Avatar

Joined: 13 May 2015
Posts: 12
Post Options Post Options   Quote Schwenk Peter Quote  Post ReplyReply Direct Link To This Post Posted: 15 Jun 2015 at 8:08pm
Thanks!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down