Answer the question
In order to leave comments, you need to log in
Why is there an error when accessing the page via https?
DD.
I'm trying to send a post request to a page via https. On google, mail, for example, everything works.
If I try to request https://api.pushbullet.com/v2/pushes , I get an error
. Actually, the problem appeared after the certificate was renewed on the site. Apparently some kind of non-standard encryption is used there and because of this an error occurs.
Has anyone come across?
Const
push_url = 'https://api.pushbullet.com/v2/pushes';
Var
PostData:TStringStream;
Title:string;
Body:String;
HTTP:TiDHTTP;
IdSSLOpenSSL:TIdSSLIOHandlerSocketOpenSSL;
Begin
HTTP:=TiDHTTP.Create();
IdSSLOpenSSL:=TIdSSLIOHandlerSocketOpenSSL.Create();
IdSSLOpenSSL.SSLOptions.SSLVersions:=[sslvSSLv23];
IdSSLOpenSSL.SSLOptions.Method := sslvSSLv23;
IdSSLOpenSSL.SSLOptions.Mode := sslmUnassigned;
HTTP.IOHandler := IdSSLOpenSSL;
Http.Request.CustomHeaders.AddValue('Authorization', 'Bearer ' + APIKey);
HTTP.Request.ContentType := 'application/json';
HTTP.Request.CharSet := 'utf-8';
Title:=Theme;
Body:=Text;
PostData:=TStringStream.Create(Utf8Encode('{"type": "note", "title": "' + Title + '", "body": "'+Body+'"}'));
PostData.Position:=0;
try
HTTP.Post(push_url,PostData);
finally
FreeAndNil(PostData);
FreeAndNil(IdSSLOpenSSL);
FreeAndNil(HTTP);
end;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question