CURL.SetOptionCookieJar
-----------------------

Sets the cookie storage file.

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

MBS( "CURL.SetOptionCookieJar"; curl; Value { ; Encoding } ) 

**MBS**( **"CURL.SetOptionCookieJar";** /\* Sets the cookie storage file. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**; /\* The file path.e.g. "/tmp/cookies.txt" \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is UTF-8.e.g. "utf8" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| curl | The CURL session handle. | $curl |  |
| Value | The file path. | "/tmp/cookies.txt" |  |
| Encoding | The text encoding for text parameter.    Default is UTF-8.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | "utf8" | Optional |

### Result

Returns "OK" on success.

### Description

Sets the cookie storage file.  
Pass a file name as string. This will make libcurl write all internally known cookies to the specified file when [CURL.Release](CURLRelease.md) is called. If no cookies are known, no file will be created. Specify "-" to instead have the cookies written to stdout. Using this option also enables cookies for this session, so if you for example follow a location it will make matching cookies get sent accordingly.  
  
If the cookie jar file can't be created or written to (when the [CURL.Release](CURLRelease.md) is called), libcurl will not and cannot report an error for this. Using [CURL.SetOptionVerbose](CURLSetOptionVerbose.md) or using Debug output will get a warning to display, but that is the only visible feedback you get about this possibly lethal situation.  
  
Starting with version 8.0 the plugin will always use UTF-8 encoding for file path on Linux and macOS. For macOS we also do the unicode character normalization for file names for you.  
See also [COOKIEJAR](https://curl.haxx.se/libcurl/c/CURLOPT_COOKIEJAR.html) option in CURL manual.

### Examples

Activate cookie engine without cookie file:

 MBS ( "[CURL.SetOptionCookieFile](CURLSetOptionCookieFile.md)"; $curl ; "")  
### See also

- [CURL.Release](CURLRelease.md)
- [CURL.SetOptionCookie](CURLSetOptionCookie.md)
- [CURL.SetOptionCookieFile](CURLSetOptionCookieFile.md)
- [CURL.SetOptionCookieList](CURLSetOptionCookieList.md)
- [CURL.SetOptionPostRedir](CURLSetOptionPostRedir.md)
- [CURL.SetOptionVerbose](CURLSetOptionVerbose.md)

### Release notes

- **Version 8.0**
    - Changed [CURL.SetOptionCAINFO](http://www.mbsplugins.eu/CURLSetOptionCAINFO.shtml), [CURL.SetOptionCAPATH](http://www.mbsplugins.eu/CURLSetOptionCAPATH.shtml), [CURL.SetOptionCookieFile](http://www.mbsplugins.eu/CURLSetOptionCookieFile.shtml), [CURL.SetOptionCookieJar](http://www.mbsplugins.eu/CURLSetOptionCookieJar.shtml), [CURL.SetOptionIssuerCert](http://www.mbsplugins.eu/CURLSetOptionIssuerCert.shtml), [CURL.SetOptionNETRCFile](http://www.mbsplugins.eu/CURLSetOptionNETRCFile.shtml), [CURL.SetOptionRandomFile](http://www.mbsplugins.eu/CURLSetOptionRandomFile.shtml), [CURL.SetOptionSSHPrivateKeyfile](http://www.mbsplugins.eu/CURLSetOptionSSHPrivateKeyfile.shtml), [CURL.SetOptionSSHPublicKeyfile](http://www.mbsplugins.eu/CURLSetOptionSSHPublicKeyfile.shtml), [CURL.SetOptionSSLCert](http://www.mbsplugins.eu/CURLSetOptionSSLCert.shtml), [CURL.SetOptionSSLKey](http://www.mbsplugins.eu/CURLSetOptionSSLKey.shtml) to use always UTF-8 on Mac/Linux and on Mac do the unicode transformation for decomposed characters to avoid trouble with special characters in file paths.

### Blog Entries

- [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)
- [MBS FileMaker Plugin, version 7.6pr3](https://www.mbsplugins.de/archive/2017-12-13/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

Created 18th August 2014 , last changed 19th April 2020

  
[CURL.SetOptionCookieFile](CURLSetOptionCookieFile.md) - [CURL.SetOptionCookieList](CURLSetOptionCookieList.md)

[HTML Version](CURLSetOptionCookieJar.shtml)