CURL.SetOptionHTTPHeader
------------------------

Sets the http header list.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionHTTPHeader"; curl; Values... ) 

**MBS**( **"CURL.SetOptionHTTPHeader";** /\* Sets the http header list. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Values...**) /\* Header valuese.g. "Content-Type: text/xml" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Values... | 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](CURLSetOptionCookie.md), [CURL.SetOptionUserAgent](CURLSetOptionUserAgent.md) and [CURL.SetOptionReferer](CURLSetOptionReferer.md).  
  
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.  
  
Do not pass special headers like Content-Length as this is set based on the given input via [CURL.SetOptionPostFields](CURLSetOptionPostFields.md). Do not set Content-Encoding as that is controlled by [CURL.SetOptionAcceptEncoding](CURLSetOptionAcceptEncoding.md).   
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat Values parameter as often as you need.  
See also [HTTPHEADER](https://curl.haxx.se/libcurl/c/CURLOPT_HTTPHEADER.html) option in CURL manual.

### 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" )  
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: \\"" &amp; $SoapRequestName &amp;"\\"")  
Query current account for Dropbox:

 # Start new session   
Set Variable \[ $curl ; Value: MBS ("[CURL.New](CURLNew.md)") \]   
\# Set URL to load (HTTP, HTTPS, FTP, FTPS, SFTP, etc.)   
Set Variable \[ $result ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "https://api.dropboxapi.com/2/users/get\_current\_account") \]   
Set Variable \[ $result ; Value: MBS ("[CURL.SetOptionCustomRequest](CURLSetOptionCustomRequest.md)"; $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](CURLPerform.md)"; $curl ) \]   
\# Check result   
Set Field \[ CURL Test::Text ; MBS ("[CURL.GetResultAsText](CURLGetResultAsText.md)"; $curl ; "UTF8") \]   
Set Field \[ CURL Test::debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl ) \]   
\# Cleanup   
Set Variable \[ $result ; Value: MBS ("[CURL.Release](CURLRelease.md)"; $curl ) \]  
OAuth2 Token authentication with passing credentials via POST:

 Set Variable \[ $Curl ; Value: MBS ("[CURL.New](CURLNew.md)") \]   
\#   
\# Change path to your CACert PEM File.   
Set Variable \[ $CacertPath ; Value: "C:\\Users\\Public\\cacert.pem" \]   
// Set Variable \[ $Result ; Value: MBS ( "[CURL.SetOptionCAInfo](CURLSetOptionCAInfo.md)"; $curl ; $cacertPath ) \]   
// Set Variable \[ $Result ; Value: MBS ( "[CURL.SetOptionSSLVerifyHost](CURLSetOptionSSLVerifyHost.md)"; $curl ; 2 ) \]   
// Set Variable \[ $Result ; Value: MBS ( "[CURL.SetOptionSSLVerifyPeer](CURLSetOptionSSLVerifyPeer.md)"; $curl ; 1 ) \]   
Set Variable \[ $Result ; Value: MBS ("[CURL.SetOptionVerbose](CURLSetOptionVerbose.md)"; $curl ; 1) \]   
\#   
\# credentials   
Set Variable \[ $secret ; Value: "xxx" \]   
Set Variable \[ $client ; Value: "yyy" \]   
Set Variable \[ $domain ; Value: "zzz" \]   
Set Variable \[ $Result ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "https://" &amp; $domain &amp; "/auth/realms/demo/protocol/openid-connect/token") \]   
\#   
\# POST with form encoding   
Set Variable \[ $result ; Value: MBS ("CURL.SetOptionHTTPHeader"; $curl ; "content-type: application/x-www-form-urlencoded") \]   
Set Variable \[ $Result ; Value: MBS ("[CURL.SetOptionPostFields](CURLSetOptionPostFields.md)"; $curl ; "grant\_type=client\_credentials&amp;client\_id="&amp; $client &amp; "&amp;client\_secret=" &amp; $secret ) \]   
\#   
\# run it   
Set Variable \[ $Result ; Value: MBS ("[CURL.Perform](CURLPerform.md)"; $curl ) \]   
Set Variable \[ $DebugText ; Value: MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl ) \]   
Set Variable \[ $ResultText ; Value: MBS ("[CURL.GetResultAsText](CURLGetResultAsText.md)"; $curl ) \]   
If \[ $result = "OK" \]   
 # extract token  
 Set Variable \[ $Token ; Value: JSONGetElement ( $ResultText ; "access\_token" ) \]   
 Set Field \[ tbl\_debugger::token ; $Token \]   
End If  
Set Field \[ tbl\_debugger::header ; $DebugText \]   
Set Variable \[ $Result ; Value: MBS ("[CURL.Release](CURLRelease.md)"; $curl ) \]  
### See also

- [CURL.GetOptionHTTPHeader](CURLGetOptionHTTPHeader.md)
- [CURL.GetOptionProxyHeader](CURLGetOptionProxyHeader.md)
- [CURL.SetOptionHTTPAuth](CURLSetOptionHTTPAuth.md)
- [CURL.SetOptionHTTPVersion](CURLSetOptionHTTPVersion.md)
- [CURL.SetOptionSSLVerifyHost](CURLSetOptionSSLVerifyHost.md)
- [CURL.SetOptionSSLVerifyPeer](CURLSetOptionSSLVerifyPeer.md)
- [CURL.SetOptionUpload](CURLSetOptionUpload.md)
- [CURL.SetOptionURL](CURLSetOptionURL.md)
- [CURL.SetOptionUserAgent](CURLSetOptionUserAgent.md)
- [CURL.SetOptionVerbose](CURLSetOptionVerbose.md)

### Release notes

- **Version 8.2**
    - Changed curl options taking lists like [CURL.SetOptionHTTPHeader](http://www.mbsplugins.eu/CURLSetOptionHTTPHeader.shtml) to accept lists as parameters.

### Example Databases

- [CURL/Email/GMail oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/GMail%20oAuth%20SMTP.shtml#3ScriptAnchor_)
- [CURL/Email/Office 365 oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Office%20365%20oAuth%20SMTP.shtml#3ScriptAnchor_)
- [CURL/WebServices/AdobeSign WebService](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/AdobeSign%20WebService.shtml#18ScriptAnchor_)
- [CURL/WebServices/CURL FMS Admin API v17](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/CURL%20FMS%20Admin%20API%20v17.shtml#1ScriptAnchor_)
- [CURL/WebServices/DeepL](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/DeepL.shtml#1ScriptAnchor_)
- [CURL/WebServices/magento older](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/magento%20older.shtml#3ScriptAnchor_)
- [CURL/WebServices/Sales Force Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/Sales%20Force%20Test.shtml#1ScriptAnchor_)
- [CURL/WebServices/TinyURL](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/TinyURL.shtml#1ScriptAnchor_)
- [CURL/WebServices/Twitter oAuth](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/Twitter%20oAuth.shtml#5ScriptAnchor_)
- [CURL/WebServices/VAT WebService Example/VAT WebService Example](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/VAT%20WebService%20Example/VAT%20WebService%20Example.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin 16.2 News](https://www.mbsplugins.de/archive/2026-05-20/MBS_FileMaker_Plugin_162_News/monkeybreadsoftware_blog_filemaker)
- [Using Gmail with oAuth2 for SMTP with MBS Plugin](https://www.mbsplugins.de/archive/2025-05-08/Using_Gmail_with_oAuth2_for_SM/monkeybreadsoftware_blog_filemaker)
- [Using ChatGPT in FileMaker](https://www.mbsplugins.de/archive/2024-10-16/Using_ChatGPT_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Adding ChatGPT to the ScriptWorkspace context menu](https://www.mbsplugins.de/archive/2024-09-18/Adding_ChatGPT_to_the_ScriptWo/monkeybreadsoftware_blog_filemaker)
- [Background Log Custom function](https://www.mbsplugins.de/archive/2024-01-09/Background_Log_Custom_function/monkeybreadsoftware_blog_filemaker)
- [Send Audit Log via CURL in background](https://www.mbsplugins.de/archive/2023-11-30/Send_Audit_Log_via_CURL_in_bac/monkeybreadsoftware_blog_filemaker)
- [How long do you wait for Insert From URL to finish?](https://www.mbsplugins.de/archive/2023-10-10/How_long_do_you_wait_for_Inser/monkeybreadsoftware_blog_filemaker)
- [CURL Custom Function](https://www.mbsplugins.de/archive/2022-12-12/CURL_Custom_Function/monkeybreadsoftware_blog_filemaker)
- [SMTP with OAuth for Office 365 in FileMaker](https://www.mbsplugins.de/archive/2022-11-22/SMTP_with_OAuth_for_Office_365/monkeybreadsoftware_blog_filemaker)
- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2021, Seite 23](https://filemaker-magazin.de/neuigkeit/4165-Appetithappen-FMM_202106)
- [Ausgabe 4/2016, Seite 19 bis 20](https://filemaker-magazin.de/neuigkeit/3876-Appetithappen-FMM_201604)

Created 18th August 2014 , last changed 7th September 2025

  
[CURL.SetOptionHTTPContentDecoding](CURLSetOptionHTTPContentDecoding.md) - [CURL.SetOptionHTTPProxyTunnel](CURLSetOptionHTTPProxyTunnel.md)

[HTML Version](CURLSetOptionHTTPHeader.shtml)