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.SetOptionHTTPHeader
Component: CURL
Version: 2.5
Mac OS X: Works
Windows: Works
MBS( "CURL.SetOptionHTTPHeader"; handle; value... )
Parameters
| Parameter | Description | Example value |
|---|---|---|
| Handle | The CURL session handle. | $curl |
| Value | Header values | "Content-Type: text/xml" |
Result
Returns "OK" on success.
Description
Sets the http header list.Pass a list of HTTP headers to pass to the server in your HTTP request. If you add a header that is otherwise generated and used by libcurl internally, your added one will be used instead. If you add a header with no content as in 'Accept:' (no data on the right side of the colon), the internally used header will get disabled. Thus, using this option you can add new headers, replace internal headers and remove internal headers. To add a header with no content, make the content be two quotes: "". The headers included in the linked list must not be CRLF-terminated, because curl adds CRLF after each header item. Failure to comply with this will result in strange bugs because the server will most likely ignore part of the headers you specified.
The first line in a request (containing the method, usually a GET or POST) is not a header and cannot be replaced using this option. Only the lines following the request-line are headers. Adding this method line in this list of headers will only cause your request to send an invalid header.
Pass a no parameters to this to reset back to no custom headers.
The most commonly replaced headers have "shortcuts" in the options CURL.SetOptionCookie, CURL.SetOptionUserAgent and CURL.SetOptionReferer.
This option takes a list of items. So this function takes a variable number of arguments. If you call function with 2 parameters, you set an empty list. If you call it with 5 parameters, you set a list with 3 values.
Examples
Set text/xml content type:
MBS( "CURL.SetOptionHTTPHeader"; $curl; "Content-Type: text/xml" )
Set two custom headers:
MBS( "CURL.SetOptionHTTPHeader"; $curl; "MyHeader1: hello"; "MyHeader2: world" )
Feedback: Report problem or ask question.
Links
MBS Realbasic Chart Plugins - Bilder aus Nickenich