cURL / Mailing Lists / curl-users / Single Mail

curl-users

multiple session cookie handling

From: Dustin Boswell <boswell_at_caltech.edu>
Date: Wed, 20 Jun 2001 01:16:07 -0700 (PDT)

I'm using curl on the command line (in a script), and
I need to maintain/update cookies in the same way a browser
would as I go through several web pages. The man page
seems to suggest the
"curl --cookie cookies.txt --dump-header cookies.txt"
approach.
But how will that work seeing that the file is overwritten
with each call to curl? I suppose I could dump the header
to a separate temporary file and append to the original. But
then the cookie.txt (or whatever the main file is) will just
grow bigger and bigger as time goes on, when it's possible
that there's only a couple of cookies that are being updated
on each web page access.
Has anyone out there handled this elegantly?
I guess I'm looking for something that does the equivalent of
"curl --cookie cookie.txt --dump-cookie cookie.txt
--dump-header who_cares.txt"
where the --dump-cookie option outputs the same cookies as
the input file (possibly updated or removed if expired), plus
any others that were encountered during the session.
If I'm missing something on how the cookie thing works with
curl, please let me know. Otherwise, what do people think
about having a --dump-cookie option?
-Dustin
Received on 2001-06-20