WebPageCustomRequestFile Function

Action

Requests and reads a complete document specified by a URL using the specified HTTP method. The optional request body consists of binary data. If the retrieved document is of content type HTML, it is parsed, and embedded documents are requested.

Include file

WebAPI.bdh

Syntax

WebPageCustomRequestFile( in sMethod  : string,
                          in sUrl     : string,
                          in sFile    : string,
                          in sContent : string optional,
                          in sTimer   : string optional,
                          in formUrl  : form optional): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sMethod HTTP method used for the request (like GET, POST, or M-GET).
sUrl Absolute URL to the file on the server. The entire character content of the query string will not be URL-encoded.
sFile File to post to the server.
sContent Content type string used in the request, for example, "image/gif" (optional). If this parameter is omitted, an "application/x-www-form-urlencoded" header is sent.
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 string is appended to the URL after the "?". All unsafe characters are URL-encoded.

Example

dcltrans
  transaction TMain
  var
    sFile: string;
  begin
    sFile := "c:\\temp\\dummyfile.txt";
    WebPageCustomRequest("GET", "http://standardhost/product.asp?code=2");
    WebPageCustomRequestFile("M-POST", "http://standardhost/product.asp", sFile,
                             "application/octet-stream", "M-Post", SHOPIT_PRODUCT_ASP002);
  end TMain;

dclform
  SHOPIT_PRODUCT_ASP002:
    "code" := "2";