1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
Begin
sUrl := 'https://monsite.com/page.php';
sParam := '?isPost=';
sParamValue := IdHTTP1.URL.ParamsEncode('1');
lst := TStringList.Create();
lst.Clear;
lst.Add('isPost=1');
//Create Stream
RspncStream := TMemoryStream.Create();
RspncStream.Clear;
RspncStream.Seek(0,soFromBeginning);
try
with IdSSLIOHandlerSocketOpenSSL1 do
begin
SSLOptions.RootCertFile := 'root.crt';
SSLOptions.CertFile := 'cert.crt';
//SSLOptions.KeyFile := 'prv.key';
Host := sUrl;
Port := 443;
end;
with IdHTTP1 do
begin
Request.ContentType := 'application/x-www-form-urlencoded';
Request.BasicAuthentication := true;
Request.Username := 'user';
Request.Password := 'pass';
if not Connected then
connect;
try
//resultat := Put(sUrl+sParam+sParamValue,RspncStream);
resultat := Post(sUrl,lst);
showmessage('RESULT :' + resultat);
except
on e : exception do
begin
Raise Exception.Create(e.ClassName+' : '+e.Message);
end;
end;
end;
finally
end;
end; |