Discuss this help topic in SecureBlackbox Forum

HTTPS: Submit (POST) a web form

If you need to post web form contents, use TElHTTPSClient.PostWebForm() method. A request may contain a one or multiple fields with values and optionally a file.

If you don't upload a file, pass null / nil / Nothing as a file stream parameter.

Examples:


C#:
TElHTTPSClient client = new TElHTTPSClient();
MemoryStream fileStream = new MemoryStream();
// put some data to send here.
...
fileStream.Position = 0;

TElStringList fieldList = new TElStringList();

// add form fields
fieldList.Add("FieldName1=FieldValue1");
// alternative variant
fieldList.Add("FieldName2", "FieldValue2");
...
client.PostWebForm("http://target.url", fieldList, "file_field_name", "uploaded_filename", fileStream, "", true);
Delphi:

var
  client : TElHTTPSClient;
  fileStream : TMemoryStream;
  fieldList : TElStringList;
...
fileStream := TMemoryStream.Create;
// put some data to send here.
...
fileStream.Position := 0;

fieldList := TElStringList.Create;
// add form fields
fieldList.Add('FieldName1=FieldValue1');
// alternative variant
fieldList.Add('FieldName2', 'FieldValue2');

client := TElHTTPSClient.Create(nil);
client.PostWebForm('http://target.url', fieldList, 'file_field_name', 'uploaded_filename', fileStream, '', true);

How To articles about client-side HTTPS questions

Discuss this help topic in SecureBlackbox Forum