cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Cookie issues

From: SmUX <smeggeruk_at_yahoo.com>
Date: Tue, 7 Sep 2004 18:25:18 +0000 (UTC)

Daniel Stenberg <daniel-curl <at> haxx.se> writes:
>
Quick note...I actually replied to this message to say I got it
working...However, the problem was that I had the non-SSL version and I am
working with an SSL enabled site (the output I posted showed me that)...but -b
still doesn't work from the cookie file, and I am having to parse the output
and manually send the cookies using -b :-)

I dunno what happened to that post...I sent it no more than 10 minutes after
the original one
 
> On Mon, 6 Sep 2004, smeggeruk wrote:
>
> > cURL vers: Current (7.12)
>
> The latest version is called 7.12.1

Whatever...I d/l it the same day I posted :-P

> > 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.

Yup, you state that in the documentation...it would be the better way for me
too if it worked :-P
 
> > The data saved for me is (actual content of cookies edited ):
>
> [headers snipped]
>
> And these cookies are saved in the -c cookiejar?

Yup, I open the file I output in notepad and can read them fine. Also, I now
(as stated somewhere, can't remember where) load the info from the cookie file
that cURL creates and manually use the info, which barely works.

> > 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)

I'll have to test that, I'll get back to you as the program is elsewhere :-)
 
> > 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

I'll take a look
 
> 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.

Yup, I know...but I like trial and error, it's how I learned to program :-)

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

Just on the off-chance that it would work if I sent cookies with the header...I
didn't think it would, but I tried anyway :-)

> > 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?).

Yup, my program outputs to _curlrc before running the program (as I can't seem
to get it working with config files either, but that's not a worry for me)
 
> > 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]

Yup, that's how I did it, although I had no space after the ; and it worked
fine...that way works fine for me, but it means I have to parse the cookie file
to get the info I need :-)
Received on 2004-09-08