Meet us at at Real World in Orlando, Florida.

All functions   Mac OS X   Windows   Crossplatform   Components   Guides  
New in version: 2.0   2.1   2.2   2.3   2.4   2.5   2.6   2.7   2.8  

CURL.SetOptionPost

Component: CURL
Version: 2.5
Mac OS X: Works
Windows: Works

MBS( "CURL.SetOptionPost"; handle; value )

Parameters

Parameter Description Example value
Handle The CURL session handle. $curl
Value Whether this is a POST request. 1

Result

Returns "OK" on success.

Description

Sets transfer to be a HTTP Post.
A parameter set to 1 tells the library to do a regular HTTP post. This will also make the library use a "Content-Type: application/x-www-form-urlencoded" header. (This is by far the most commonly used POST method).

Use one of CURL.SetOptionPostFields options to specify what data to post and CURL.SetOptionPostFieldSize or CURL.SetOptionPostFieldSizeLarge to set the data size.

Optionally, you can provide data to POST using the CURL.SetInput* functions but then you must make sure to not set CURL.SetOptionPostFields to anything but "". When providing data with a callback, you must transmit it using chunked transfer-encoding or you must set the size of the data with the SetOptionPostFieldSize or CURL.SetOptionPostFieldSizeLarge option. To enable chunked encoding, you simply pass in the appropriate Transfer-Encoding header.

You can override the default POST Content-Type: header by setting your own with CURL.SetOptionHTTPHeader.

Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with CURL.SetOptionHTTPHeader as usual.

If you use POST to a HTTP 1.1 server, you can send data without knowing the size before starting the POST if you use chunked encoding. You enable this by adding a header like "Transfer-Encoding: chunked" with CURL.SetOptionHTTPHeader. With HTTP 1.0 or without chunked transfer, you must specify the size in the request.

When setting CURL.SetOptionPost to 1, it will automatically set CURL.SetOptionNoBody to 0 (since 7.14.1).

If you issue a POST request and then want to make a HEAD or GET using the same re-used handle, you must explicitly set the new request type using CURL.SetOptionNoBody or CURL.SetOptionGet or similar.

Feedback: Report problem or ask question.




Links
MBS Real Studio PDF Plugins - Pfarrgemeinde Messdiener Nickenich