

Delphi7通过Post方式提交数据到https页面.txt
Error Connecting with SSL //该错误比较奇怪,get方式获取https://www.baidu.com/网址没事,获取https://www.jd.com/就提示这个错误
procedure TForm1.Button2Click(Sender: TObject);
var
output : TMemoryStream;
sHtml:string;
PostData : TStringStream;
begin
IdHTTP1.HandleRedirects := true;
IdHTTP1.AllowCookies := true;
IdHTTP1.IOHandler := TIdSSLIOHandlerSocket.Create(IdHTTP1);
//IdHTTP1.CookieManager := TIdCookieManager.Create(IdHTTP1);
with TIdSSLIOHandlerSocket(IdHTTP1.IOHandler) do begin
SSLOptions.Method := sslvTLSv1;
SSLOptions.Mode := sslmUnassigned;
SSLOptions.VerifyMode := [];
SSLOptions.VerifyDepth := 0;
PassThrough := True;
end;
IdHttp1.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0';
IdHTTP1.RedirectMaximum := 30;
PostData := TStringStream.Create('');
PostData.Position := 0; //需要这句,否则页面只能接收到第1个参数
//方式1:多个参数合成一个字符串
//PostData.WriteString('title2=55555&messageUrl2=http://www.baidu.com&picUrl2=http://aa.8y8z.com:8081/a/diguophp/img/logo.gif');
//方式2:多个参数分开,但是第2个参数开始后面的参数前要加&,否则系统会认为都是第一个参数的值
PostData.WriteString('title2=666666');
PostData.WriteString('&messageUrl2=http://www.baidu.com');
PostData.WriteString('&picUrl2=http://aa.8y8z.com:8081/a/diguophp/img/logo.gif');
sHtml := IdHTTP1.Get('https://www.baidu.com/');//<----Error here
Memo1.Text:=Utf8ToAnsi(sHtml);
PostData.Free;
end;
procedure TForm32.Button1Click(Sender: TObject);
var
output : TMemoryStream;
begin
output:=TMemoryStream.Create;
// IdOpenSSLSetLibPath(
try
IdHTTP1.get('https://localhost:444/Folder/service.svc',output);
output.position := 0;
memo1.lines.LoadFromStream(output);
except
on exception do
ShowMessage(WhichFailedToLoad());
end;
end;