Discuss this help topic in SecureBlackbox Forum

Post web forms and data

To post the data to the HTTP server, use Post() method of TElHTTPSClient class.

Post() method is overloaded, i.e. it provides several ways of use.

The simpliest variant of Post() method accepts only the remote URI to post the data to and a text string, array of bytes or data stream with content.

The advanced variant of Post() method lets you specify

  1. the fields of the web form in the "Name=Value" form using Fields parameter
  2. the file to be sent using FileField, FileName and FileStream parameter

When you pass the data stream to one of Post() methods, you need to specify if the stream is closed and the content is freed assigning True to the CloseStream parameter. In other words, you specify, who owns the stream after it is passed and who will need to close / dispose of the stream.

FileField specifies the name of the field in the web form, which denotes a file. Don't include this field to the list of fields of the web form.

Before posting the data, you can change content type of the data using ContentType property of TElHTTPRequestParams class. If the value is empty, "application/octet-stream" will be sent.

There are several ways to obtain the response. First way is to provide the destination stream using OutputStream property of TElHTTPSClient class. The data, received using Get() method will be saved there. Another way is to provide a handler for OnData event.

To track progress of the operation use OnProgress event.

To cancel the operation and close connection use CancelRequest() method.

Discuss this help topic in SecureBlackbox Forum