Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

CURL.SetOptionCookieJar

Sets the cookie storage file.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionCookieJar"; curl; Value { ; Encoding } )   More

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.
"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 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 is called), libcurl will not and cannot report an error for this. Using CURL.SetOptionVerbose 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 option in CURL manual.

Examples

Activate cookie engine without cookie file:

MBS( "CURL.SetOptionCookieFile"; $curl; "")

See also

Release notes

Blog Entries

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


CURL.SetOptionCookieFile - CURL.SetOptionCookieList