Quelle est la manière la plus simple de faire une requête POST HTTPS dans Delphi? Je n'ai pas de problème avec les requêtes HTTP POST, mais comment puis-je le faire en utilisant SSL? J'ai fait un googled autour et n'ai rien trouvé qui explique cela assez bien.Comment faire une requête HTTPS POST en Delphi?
Voici le code que j'ai essayé:
procedure TForm1.FormCreate(Sender: TObject);
var
responseXML:TMemoryStream;
responseFromServer:string;
begin
responseXML := TMemoryStream.Create;
IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(self);
with idSSLIOHandlerSocketOpenSSL1 do
begin
SSLOptions.Method := sslvSSLv2;
SSLOptions.Mode := sslmUnassigned;
SSLOptions.VerifyMode := [];
SSLOptions.VerifyDepth := 0;
host := '';
end;
IdHTTP1 := TIdHTTP.Create(Self);
with IdHTTP1 do
begin
IOHandler := IdSSLIOHandlerSocketOpenSSL1;
AllowCookies := True;
ProxyParams.BasicAuthentication := False;
ProxyParams.ProxyPort := 0;
Request.ContentLength := -1;
Request.ContentRangeEnd := 0;
Request.ContentRangeStart := 0;
Request.Accept := 'text/html, */*';
Request.BasicAuthentication := False;
Request.UserAgent := 'Mozilla/3.0 (compatible; Indy Library)';
HTTPOptions := [hoForceEncodeParams];
end;
responsefromserver := IdHTTP1.Post('https://.../','name1=value1&name2=value2&....');
end;
Lorsque je tente de l'exécuter, je reçois l'erreur suivante:
Project myProject.exe raised exception class EFOpenError with message 'Cannot open file "C:\...\Projects\Debug\Win32\name1=value1name2=value2 The system cannot find the file specified'.
Je ne comprends pas. J'ai envoyé des paramètres, bien que les erreurs semblent comme si j'aurais envoyé un fichier.
J'ai également inclus libeay32.dll et ssleay32.dll dans mon dossier myProject.exe.
Avez-vous déjà trouvé un correctif pour cela? –