xref: /curl/docs/cmdline-opts/cookie-jar.md (revision fe9f68fa)
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
14Example:
15  - -c store-here.txt $URL
16  - -c store-here.txt -b read-these $URL
17---
18
19# `--cookie-jar`
20
21Specify to which file you want curl to write all cookies after a completed
22operation. Curl writes all cookies from its in-memory cookie storage to the
23given file at the end of operations. Even if no cookies are known, a file is
24created so that it removes any formerly existing cookies from the file. The
25file uses the Netscape cookie file format. If you set the filename to a single
26minus, "-", the cookies are written to stdout.
27
28The file specified with --cookie-jar is only used for output. No cookies are
29read from the file. To read cookies, use the --cookie option. Both options
30can specify the same file.
31
32This command line option activates the cookie engine that makes curl record
33and use cookies. The --cookie option also activates it.
34
35If the cookie jar cannot be created or written to, the whole curl operation
36does not fail or even report an error clearly. Using --verbose gets a warning
37displayed, but that is the only visible feedback you get about this possibly
38lethal situation.
39