Synapse Delphi HTTPS SSL GET Request

2019-03-22 00:38发布

Only a GET request to a HTTP url works. If i try to request a HTTPS url then it doesn't return anything. I pretty much tried everything. Appreciate any help.

Here's my code:

 SynHttp.Sock.CreateWithSSL(TSSLOpenSSL);
 SynHttp.Sock.SSLDoConnect;
 SynHttp.HTTPMethod('GET', 'https://www.google.com/');
 Resp.LoadFromStream(SynHttp.Document);
 HtmlResponse := Resp.Text;

SynHTTP is a THTTPSend object.

1条回答
对你真心纯属浪费
2楼-- · 2019-03-22 01:15

Make sure:

  1. your exe application can access ssleay32.dll and libeay32.dll - the easiest way is to copy them into the directory of your exe.
  2. you added ssl_openssl.pas and ssl_openssl_lib.pas to your project.

Then it should work instantly.

查看更多
登录 后发表回答