Qual è il modo più semplice per eseguire una richiesta POST HTTPS in Delphi? Non ho problemi con le richieste HTTP POST, ma come posso farlo usando SSL? Ho cercato su Google e non ho trovato nulla che lo spieghi abbastanza bene.Come effettuare una richiesta POST HTTPS in Delphi?
Ecco il codice che ho provato:
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;
Quando provo a farlo funzionare io ottenere il seguente errore:
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'.
Non capisco questo. Ho inviato i parametri, anche se gli errori sembrano come se avessi inviato un file.
Inoltre ho incluso libeay32.dll e ssleay32.dll nella mia cartella myProject.exe.
Hai mai trovato una soluzione per questo? –