Posts binary data 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.
Instead of ASCII-encoded form content, binary data may be sent using this post function. The Content-Length header will automatically be added to the request. The appropriate Content-Type has to be specified. In order to send binary data (octets) more safely over the Internet, use the WebBase64Encode to convert the data to 6-bit ASCII characters.
WebAPI.bdh
WebFormPostBin( in sUrl : string, in formUrl : form, in sData : string, in nDataLen : number, in sContentType : string, in fWait : float optional): boolean;
true successful.
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 "?". |
sData | Data to post to the server. This may be also binary data. For posting all available binary data specify STRING_COMPLETE for nDataLength and use the bin() operator for sData (see example). |
nDataLen | Length in bytes of data contained in the buffer sData. Specify STRING_COMPLETE or omit this parameter to post all available data. |
sContentType | Content type string used in the request, for example, "image/gif" |
fWait | Minimum time or minimum mean time that this function call has to last (optional). The 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 to post data as provided to the Web server.
dcltrans transaction TWebFormPostBin var sData : string; begin // Post hard coded binary data in hexadecimal form // (first 16 ASCII sequences) along with an additional sub query sData := "\h00010203040506070809101112131415"; WebFormPostBin("http://standardhost/data2html.asp", FORM_01, bin(sData), STRING_COMPLETE, "binary/costum", 0.0); end TWebFormPostBin; dclform FORM_01: "SessionID" := "SID12345";
WebForms02.bdf, WebPost01.bdf