WebCustomRequest Function

Action

Requests and reads a complete document specified by a URL using the specified HTTP method.

Include file

WebAPI.bdh

Syntax

WebCustomRequest( in sMethod  : string,
                  in sUrl     : string,
                  in formBody : form optional,
                  in formUrl  : form optional,
                  in fWait    : float 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 WebCustomRequest 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.

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.

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.

fWait Minimum time or minimum mean time that this function call has to last (optional). The default value is 0.0.

Example

dcltrans
  transaction TMain
  begin
    WebCustomRequest("GET", "http://standardhost/product.asp?code=2");
    WebCustomRequest("M-POST", "http://standardhost/product.asp",
SHOPIT_PRODUCT_ASP003, SHOPIT_PRODUCT_ASP002);
  end TMain;

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