WebPageCustomRequest Function

Action

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

Include file

WebAPI.bdh

Syntax

WebPageCustomRequest( in sMethod  : string,
                      in sUrl     : string,
                      in formBody : form 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.
formBody

Form identifier used in the dclform section (optional). The expanded form is added to the body of the request. The Content-Length and Content-Type headers are added automatically. The default Content-Type is "application/x-www-form-urlencoded" and can be overwritten by a WebHeaderAdd("Content-Type", "myEncoding") function call prior to the WebPageCustomRequest function call.

Set this parameter to FORM_NULL if you do not want to specify a form. You would do this when you want to specify the following parameters but want to omit this parameter.

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
  begin
    WebPageCustomRequest("GET", "http://standardhost/product.asp?code=2");
    WebPageCustomRequest("M-POST", "http://standardhost/product.asp",
      SHOPIT_PRODUCT_ASP003, "ShopIt - Product", SHOPIT_PRODUCT_ASP002);
  end TMain;

dclform
  SHOPIT_PRODUCT_ASP002:
    "code" := "2";
  SHOPIT_PRODUCT_ASP003:
    "tent" := "1";