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

CURL.SetOptionCookie

Sets the cookie for the current http transfer.

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

Parameters

Parameter Description Example Flags
curl The CURL session handle. $curl
Value The cookie string. ""
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 for the current http transfer.
Pass a cookie string. It will be used to set a cookie in the http request. The format of the string should be NAME=CONTENTS, where NAME is the cookie name and CONTENTS is what the cookie should contain.

If you need to set multiple cookies, you need to set them all using a single option and thus you need to concatenate them all in one single string. Set multiple cookies in one string like this: "name1=content1; name2=content2;" etc.

This option sets the cookie header explicitly in the outgoing request(s). If multiple requests are done due to authentication, followed redirections or similar, they will all get this cookie passed on.

Using this option multiple times will only make the latest string override the previous ones.

Cookie format is explained here:
https://humanwhocodes.com/blog/2009/05/05/http-cookies-explained/

See also COOKIE option in CURL manual.

Examples

Pass 4 cookies together:

MBS( "CURL.SetOptionCookie"; $curl; "ORA_WX_SESSION="32230CEE0E940BDFA8157FEF3EB58E9CBD8A5699-3#1"; ObSSOCookie=VPAEWqhsUTbSXpHB0%3BqRDXNegpZBgeCgR1GJ3Ysou0A5%3FyUdO0ffMSHUl7fN0mg4cVonDmjnakVdoYpnigAR4mAeWUMk6sLw%3BqwSCmY1bCfxhdWcoOS4NhaifxRazpYpEywzdqQ3kRkNwRpECdBrwWdcFBCo6TROhgEufbykS%3FSYU%3FwJT%3FP95WgkCRMBkJBE2LSk%3B1F2BtBjBGDa42jFR8gK7bE0ewJ%3B1MM6vzq93scwL9NO%3BbCixrvJlGYL8fQWG%3BwewaIRRf4i3IcThDQBHg%2D%2D; JSESSIONID=EPQSsbjcndhPqEtvW8MQS8sQCGWta7QQQMi8k6eiT_EcoNB_YOqL!-166722973; ObSSOCookie=ktizpHi8mrSLizEejydmRivWZu%3BHr99%3BVh%3FTLFhIMRweTbStBfibTYNPa%3FpMErio42eAQ30r1SVrTmuTLbI9Cyh3KPAqR5x%3BPs6rQQbRfZrpThhgSuPZzRx7NI9S9gKQYmeWAKkIRETUR9XZKuU1ll7GwK4Ci0QFSwON2sU12EPvns9Y8RFNWHNsdfDpNXn4qdfDvOhP8VnnYNMjvZnq%3Fofg%3Fxd3QfOZnL2Z86riaRz4gq5IeKolxN7iWM4%3FIcYk2nMeEx4A9iRtftPFyGEBWpxxtMG6UsE2RMhLqMpV4Lg%2D"; "UTF-8" )

See also

Release notes

Blog Entries

Created 18th August 2014, last changed 27th February 2019


CURL.SetOptionConnectionTimeout - CURL.SetOptionCookieFile