WebPageCustomRequestBin 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

WebPageCustomRequestBin( in sMethod     : string,
                         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 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.
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" (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
    sData: string(4);
  begin
    SetLong(sData, 1, 15708);
    WebPageCustomRequest("GET", "http://standardhost/product.asp?code=2");
    WebPageCustomRequestBin("M-POST", "http://standardhost/product.asp", bin(sData),
        STRING_COMPLETE, "application/octet-stream",
        "M-Post", SHOPIT_PRODUCT_ASP002);
  end TMain;

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