Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Sets the http header list.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
curl | The CURL session handle. | $curl |
Values | Header values | "Content-Type: text/xml" |
Returns "OK" on success.
See also HTTPHEADER option in CURL manual.
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" )
Call with three parameters:
MBS( "CURL.SetOptionHTTPHeader"; handle; $value1; $value2; $value3 )
For SOAP, set content type and disable Expect header:
MBS("CURL.SetOptionHTTPHeader"; $curl; "Expect:"; "Content-Type: text/xml")
Set content type including a soap action:
MBS( "CURL.SetOptionHTTPHeader"; $curl; "Content-Type: application/soap+xml;charset=UTF-8;action=\"urn:sap-com:document:sap:soap:functions:mc-style:ZMF_WS_00:ZmfWs00Request\"" )
Request no cached copy:
MBS("CURL.SetOptionHTTPHeader"; $curl; "Cache-Control: no-cache")
Set content type for URL encoded form data:
MBS( "CURL.SetOptionHTTPHeader"; $curl; "Content-Type: application/x-www-form-urlencoded" )
Using a bearer for a webservice:
MBS( "CURL.SetOptionHTTPHeader"; $curl; "Authorization: Bearer a92eabb9-76f9-42ee-b280-bcd15cb2e9db"; "Content-Type: application/json")
Set SOAP Action and Content-Type for webservice:
MBS("CURL.SetOptionHTTPHeader"; $curl;
"Content-Type: text/xml;charset=\"utf-8\"";
"SOAPAction: \"" & $SoapRequestName &"\"")
Query current account for Dropbox:
# Start new session
Set Variable [ $curl ; Value: MBS("CURL.New") ]
# Set URL to load (HTTP, HTTPS, FTP, FTPS, SFTP, etc.)
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; "https://api.dropboxapi.com/2/users/get_current_account") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionCustomRequest"; $curl; "POST") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionHTTPHeader"; $curl; "Accept: */*"; "Authorization: Bearer xxx"; "Cache-Control: no-cache"; "accept-encoding: gzip, deflate"; "cache-control: no-cache"; "content-length:") ]
# RUN now
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
# Check result
Set Field [ CURL Test::Text ; MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugAsText"; $curl) ]
# Cleanup
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]
Created 18th August 2014, last changed 30th April 2020
CURL.SetOptionHTTPContentDecoding - CURL.SetOptionHTTPProxyTunnel
Feedback: Report problem or ask question.