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.
WebAPI.bdh
WebFormPostEx( inout sUrl : string, in formUrl : form, in formBody : form, in fWait : float optional ) : boolean;
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.
var nWait : float; sName : string(100); dclrand rnWait : RndExpF(5.0); rnPhone : RndStr("0123456789"; 16..16); rsAddress : RndFile("Address.rnd", 100); rsFName : RndFile("gfname.rnd", 20); rsLName : RndFile("glname.rnd", 20); dcltrans transaction TWebFormPostEx begin // Get a random full name sName := rsFName + " " + rsLName; // and a random think time nWait := rnWait; WebFormPostEx("http://standardhost:2080/data2html.asp", FORM_01, FORM_01, nWait); end TWebFormPostEx; dclform FORM_01: "name" := sName, "address" := rsAddress, "p hone" := rnPhone;
WebForms01.bdf, WebPost01.bdf, WebTimer01.bdf