WebPagePost Function

Action

Posts binary data to the Web server by means of the HTTP POST method. If the optional form for the query string includes a random variable, this function selects a new random value each time the form is posted. If the retrieved document is of content-type HTML, it is parsed and embedded documents are retrieved.

Instead of ASCII-encoded form content, binary data may be sent using this post function. The Content-Length header is automatically added to the request. The appropriate Content-Type has to be specified. In order to send binary data (octets) more safely over the Internet, use the WebBase64Encode function to convert the data to 6-bit ASCII characters.

Include file

WebAPI.bdh

Syntax

WebPagePost( in sUrl        : string,
             in sData       : string,
             in nDataLength : number optional,
             in sContent    : string optional,
             in sTimer      : string optional,
             in formUrl     : form optional ): boolean;

Return value

  • true if the page is downloaded successfully

  • false otherwise

Parameter Description
sUrl Absolute URL to the document on the server. All characters that are part of the query string are not URL-encoded.
sData Data to post to the server. This may also be binary data. For posting all available binary data specify STRING_COMPLETE for nDataLength and use the bin() operator for sData (see example).
nDataLength Amount of the data that is posted to the server (in bytes). Specify STRING_COMPLETE or omit this parameter to post all available data.
sContent Content type string used in the request, for example, "image/gif".
sTimer Name of the timer used for page measurements (optional). If this parameter is omitted, no measurements are performed.
formUrl Form identifier used in the dclform section (optional). The expanded form is added to the URL after the "?".

Example

dcltrans
  transaction TWebPagePost
  begin
    // Post hard coded binary data in hexadecimal form
    // (first 20 ASCII sequences) along with an additional sub query
    WebPagePost("http://standardhost/data2html.asp",
        "\h0001020304050607080910111213141516171819",
        STRING_COMPLETE, "binary/custom", "Dummy Timer", FORM_01);
  end TWebPagePost;

dclform
  FORM_01:
    "SessionID" := "SID12345";