xref: /curl/docs/cmdline-opts/cookie-jar.md (revision 179c5240)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Short: c
5Long: cookie-jar
6Arg: <filename>
7Protocols: HTTP
8Help: Save cookies to <filename> after operation
9Category: http
10Added: 7.9
11Multi: single
12See-also:
13  - cookie
14  - junk-session-cookies
15Example:
16  - -c store-here.txt $URL
17  - -c store-here.txt -b read-these $URL
18---
19
20# `--cookie-jar`
21
22Specify to which file you want curl to write all cookies after a completed
23operation. Curl writes all cookies from its in-memory cookie storage to the
24given file at the end of operations. Even if no cookies are known, a file is
25created so that it removes any formerly existing cookies from the file. The
26file uses the Netscape cookie file format. If you set the filename to a single
27minus, "-", the cookies are written to stdout.
28
29The file specified with --cookie-jar is only used for output. No cookies are
30read from the file. To read cookies, use the --cookie option. Both options
31can specify the same file.
32
33This command line option activates the cookie engine that makes curl record
34and use cookies. The --cookie option also activates it.
35
36If the cookie jar cannot be created or written to, the whole curl operation
37does not fail or even report an error clearly. Using --verbose gets a warning
38displayed, but that is the only visible feedback you get about this possibly
39lethal situation.
40