WebFormPostEx Function


Posts the contents of two forms to the Web server by means of the HTTP POST method. If the form includes a random variable, this function selects a new random value each time the form is posted.

The difference between this function and the WebFormPost is that a form may be posted in the body of the request in addition to the URL.

Include file



WebFormPostEx( inout sUrl     : string,
               in    formUrl  : form,
               in    formBody : form,
               in    fWait    : float optional ) : boolean;

Return value

  • true if the worker thread posting the form content to the server could be started successfully

  • false otherwise

Parameter Description
sUrl Complete URL to the file on the server
formUrl Form identifier used in the dclform section (see example below). The expanded form is added to the URL after the "?".
formBody Form identifier used in the dclform section (see example below). The expanded form is added to the body of the request. The Content-Length and Content-Type header are added automatically. The default Content-Type is application/x-www-form-urlencoded and can be overwritten by a call to WebHeaderAdd("Content-Type", "myEncoding") prior to invoking WebFormPostEx.
fWait Minimum time or minimum mean time that this function call has to last (optional). Default value is 0.0

The form content in the dclform section is represented in an unencoded format to enhance readability and customizability. The data gets URL encoded on form submission. There are two possibilities to send data unencoded:

  • Add the query string as it should be sent to the server directly to the URL, for example, "http://www.comp.com/cgi/special?<don't>;[encode]/this". Note that blanks are encoded when this method is used.

  • Use WebUrlPostBin or WebFormPostBin to post data as provided to the Web server.


  nWait : float;
  sName : string(100);

  rnWait    : RndExpF(5.0);
  rnPhone   : RndStr("0123456789"; 16..16);
  rsAddress : RndFile("Address.rnd", 100);
  rsFName   : RndFile("gfname.rnd", 20);
  rsLName   : RndFile("glname.rnd", 20);

  transaction TWebFormPostEx
    // Get a random full name
    sName := rsFName + " " + rsLName;
    // and a random think time
    nWait := rnWait;
    FORM_01, FORM_01, nWait);
  end TWebFormPostEx;

  "name"    := sName,
  "address" := rsAddress,
  "p hone"  := rnPhone;

Sample scripts

WebForms01.bdf, WebPost01.bdf, WebTimer01.bdf