06-16-2018, 01:52 PM
I am using XE8.
My openssl dlls are in 1.0.2.13 version.
I have the next site with the documentation to get some currency exchange values:
https://api.promasters.net.br/cotacao/#documentacao
I am trying the next code, but I get an error:
if I put the next line into browser "http://api.promasters.net.br/cotacao/v1/valores" it returns the correct values.
How could I fix it?
My code:
My openssl dlls are in 1.0.2.13 version.
I have the next site with the documentation to get some currency exchange values:
https://api.promasters.net.br/cotacao/#documentacao
I am trying the next code, but I get an error:
Code:
'Error connecting with SSL.'#$D#$A'error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'
if I put the next line into browser "http://api.promasters.net.br/cotacao/v1/valores" it returns the correct values.
How could I fix it?
My code:
Code:
const ss='http://api.promasters.net.br/cotacao/v1/valores';
var
s: string;
lHTTP: TIdHTTP;
HandlerSock:TIdSSLIOHandlerSocketOpenSSL;
begin
lHTTP := TIdHTTP.Create(nil);
lHTTP.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0';
try
HandlerSock:=TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP);
HandlerSock.SSLOptions.Method := sslvSSLv23;
HandlerSock.SSLOptions.SSLVersions := [sslvTLSv1_2, sslvTLSv1_1, sslvTLSv1];
lHTTP.IOHandler := HandlerSock;
lHTTP.HandleRedirects := True;
s := lHTTP.Get(ss);
ShowMessage(s);
finally
lHTTP.Free;
end;
end;