cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Cookie issues

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 6 Sep 2004 16:29:11 +0200 (CEST)

On Mon, 6 Sep 2004, smeggeruk wrote:

> cURL vers: Current (7.12)

The latest version is called 7.12.1

> I have attempted to use your s/w to connect to an account on www.outwar.com
> and download the webpage to collect stats on the account. However, I can't
> seem to get -b or -c to work when storing cookies. I should point out that
> the cookies *are* saved to a file (both with using this method or
> --dump-header

-c is the better way to store cookies.

> The data saved for me is (actual content of cookies edited :-)):

[headers snipped]

And these cookies are saved in the -c cookiejar?

> If I then load (for instance) http://www.outwar.com/pointstore.php the file
> says that I must be logged into the account to view this page, even though
> I've given the info via the cookies, I assume.

... and the cookies are actually used in the request? (-v or --trace would
tell)

> A friend of mine suggested looking at
> http://www.garshol.priv.no/download/text/http-tut.html and working out how
> to add the cookie info into the request header, but I dunno what I am doing

It would recommend this: http://curl.haxx.se/docs/httpscripting.html

If you don't understand these things, you will need to do trial and error an
awful lot and I know I would consider that boring.

> Note: Although I know it isn't anything to do with it, I even tried -H...and

-H to do what?

> I also tried -L to set the location

-L does not "set" any location, it just asks curl to follow Location: hints
passed by the server. When doing login-scripting, I find myself using -L very
often.

> but it kept on telling me that it was ignoring trailing garbage :-)

Then you didn't use it properly (and had the option in a config file, right?).

> Another thing I tried was editing the line 'curl -b "name=Daniel"
> www.sillypage.com' to use the cookies received previously (I took them from
> the cookies outputted with --dump-header) but I'm not sure how to format it
> for multiple cookies, and IIRC I used ; between each one.

Correct. It could look like this:

  curl -b "name=Daniel; age=veryveryold; insane=yes" [URL]

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-09-06