PostData Property
The data to post with the URL if the POST method is used.
Syntax
http.getPostData([callback]) http.setPostData( postData_Buffer, [callback])
Default Value
""
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for the getPostData([callback]) method is defined as:
function(err, buffer){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'buffer' is the value returned by the method.
The callback for the setPostData([callback]) method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
If this method is a non-empty string, then if the HTTP Post method is used. The contents of this property are appended to the HTTP request after the HTTP headers.
An HTTP 'Content-Length' header is also added to the request. Its value is the length of the string in PostData, or, if the AttachedFile property has been set, the cumulative length of the string and the file. See the description of the AttachedFile property for details.
If the goal is to upload a file or binary form data to a receiving script, the postdata must be MIME encoded. The WebUpload component is specifically designed for this and will perform all of the MIME encoding for you automatically. The WebForm component can be used for any form data posting.
The most common example is posting of HTML form input data. In that case, the ContentType property must be set to "application/x-www-form-urlencoded".
Example (Performing a Post)
HTTPControl.ContentType = "application/x-www-form-urlencoded" HTTPControl.PostData = "firstname=Tom&lastname=Thompson&country=US" HTTPControl.Post(myurl)
This property is not available at design time.
Data Type
Buffer