Send HTTP data to a web server or CGI program.
function Post( AURL: string; ASource: TIdStream ): string; overload;
Parameters |
Description |
ASource |
Stream containing the request data. |
URL |
Location of the host or CGI application. |
String - Values received in a Response for the HTTP POST method.
Post is an overloaded method that is used to send data specified in ASource to the resource location in AURL. Post is overloaded to allow use of either TIdStrings or TIdStream object instances in ASource, and also provides procedure- and function-based variants of the method to allow String return values or storage of return values in AResponseContent.
By default, Indy will restrict all POST requests to the use of HTTP version 1.0 in the headers for the request. This occurs because some HTTP servers do not respect the RFC for HTTP 1.1 to the full extent of the specification. In particular, most servers do not send or expect to receive the 100-Continue HTTP header.
To use HTTP version 1.1 requests when calling the Post method, include the value hoKeepOrigProtocol in the HTTPOptions property. Please note that this does not include retaining a HTTP persistent connection for the session; persistent connections established using the HTTP 'Keep-Alive' header are always closed prior to performing an HTTP Post operation.
This variant of the Post method prepares an HTTP request from the values in ASource, but does not perform any preprocessing for the content type of the request or values in the ASource stream. Set the ContentType property in the Reqest to indicate if ASource contains form-url encoded or multipart data.
Post calls a protected method in the HTTP client to perform the HTTP transfer.
Exceptions |
Description |
EAssertionFailed |
Raised if the source stream for the request is unassigned. |
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
|
Post feedback to the Indy Docs Newsgroup.
|