program ssltest;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, system.Classes, idhttp, IdSSLOpenSSL;
const
url = '
https://www.bundesbank.de/statistic-rmi/StatisticDownload?tsId=BBEX3.M.JPY.EUR.BB.AC.A02';
var
httpClient: TIDHttp;
ioHandler: TIdSSLIOHandlerSocketOpenSSL;
sResponse: TStringStream;
begin
try
httpClient := TIdHttp.Create(
nil);
try
ioHandler := TIdSSLIOHandlerSocketOpenSSL.Create(httpClient);
ioHandler.SSLOptions.Method := sslvTLSv1_2;
ioHandler.SSLOptions.SSLVersions := [sslvTLSv1_2];
httpClient.IOHandler := ioHandler;
sResponse := TStringStream.Create;
try
httpClient.Get(
url, sResponse);
case httpClient.ResponseCode
of
200: sResponse.SaveToFile('
c:\tmp\bb.csv');
end;
finally
sResponse.Free;
end;
finally
httpClient.Free;
end;
except
on E:
Exception do
Writeln(E.ClassName, '
: ', E.
Message);
end;
end.