WebFormHead Function

Action

Sends the form content to the Web server. The form content is transformed into a single string that is appended to the URL. The URL defines the file to be retrieved from the Web server by means of the HTTP HEAD method. If the form includes a random variable, this function selects a new random value each time the form is posted.

Include file

WebAPI.bdh

Syntax

WebFormHead( in sUrl   : string,
             in idForm : form,
             in fWait  : float optional ) : boolean;

Return value

  • true if the worker thread communicating with the server could be started successfully

  • false otherwise. The return value will not inform about any Web traffic-related problems due to independent threaded operation.

Parameter Description
sUrl Complete URL to the file on the server
idForm Form identifier used in the dclform section (see example below)
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?dont encode blanks

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

Example

var
  rsRandomRequestString : string;
dcltrans
  transaction TWebFormHead
  begin
    ...
    WebFormHead("http://www.myserver.com/mail2form.cgi",
    FORM_CUST_REQUEST, 0.0);
    ...
    end TWebFormHead;

dclform
  FORM_CUST_REQUEST:
  "email"   := "joe@somewhere.com",
  "request" := rsRandomRequestString;