PostData Method

Submits the contents of the specified buffer to a script on the remote server.

Syntax

object.PostData( Resource, ResourceData, Buffer, [Options] )

Remarks

The PostData method submits the contents of the specified buffer to a script on the remote server and returns the result in a string or byte array provided by the caller. This method will cause the current thread to block until the operation completes, a timeout occurs or the post is canceled. During the operation, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

Resource
A string that specifies the resource that the data will be posted to on the remote server. Typically this is the name of an executable script.
ResourceData
A string or byte array that contains the data which will be provided to the script. If the script expects binary data, it is recommended that a byte array be used.
Buffer
A string or byte array that will contain the output generated by the script. Typically this is HTML content which is generated by the script as a result of processing the data that was posted to it.
Options
An optional integer value which specifies one or more options. This argument is constructed by using a bitwise operator with any of the following values:
Constant Description
httpPostDefault The default post mode. The contents of the buffer are encoded and sent as standard form data. The data returned by the server is copied to the result buffer exactly as it is returned from the server.
httpPostConvert If the data being returned from the server is textual, it is automatically converted so that the end of line character sequence is compatible with the Windows platform. Individual carriage return or linefeed characters are converted to carriage return/linefeed character sequences. Note that this option does not have any effect on the form data being submitted to the server, only on the data returned by the server.
httpPostMultipart The contents of the buffer being sent to the server consists of multipart form data. This causes the Content-Type request header field to be set to multipart/form-data and the contents of the buffer will be sent as-is without any encoding.

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

See Also

GetData Method, GetFile Method, PostFile Method, PostXml Method, PutData Method, PutFile Method, OnProgress Event


Copyright © 2008 Catalyst Development Corporation. All rights reserved.