cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Easy "POST" question but cannot figure it out!!

From: <jon_at_linertia.com>
Date: Thu, 15 Nov 2007 22:34:41 -0800 (PST)

>> At 10:16 +0100 11/15/07, Daniel Stenberg wrote:
>>>Right, but since you used LiveHTTPHeaders you should be able to tell if
>>> perhaps the site provides a cookie when it presents the form (on a
>>> GET),
>>> and then assumes you to provide them when you send the POST. Thus,
>>> you'd
>>> need to do two requests. Lots of sites and servers do this, and the
>>> logs
>>> will tell you the details.
>>
>> Note that curl offers its own incoming header viewing with the -D
>> filename
>> option. It's possible that the coolies delivered to you using FireFox
>> are
>> not really the same as what you get using curl. It's also possible that
>> the cookie you should return isn't exactly the same as what is
>> delivered.
>> JavaScript can muck with them.
>>

Is there anyway to fix the above problem? if curl is getting the wrong
cookies? See post below.

>> Try the initial GET using curl while saving the headers to a file and
>> see
>> what they say.
>> --
>>
>> --> From the U S of A, the only socialist country that refuses to admit
>> it. <--
>>
>
> Thanks! I'll try all of your suggestions.
>
>

Okay! After hours of work I've nailed down my problem. using curl, the
cookie is being replaced with another value (not sure why). See below:

When I run the curl operation on the website of interest, i.e.

curl -vc cookie "www.example.com"

the verbose output http header gives me:

Added cookie session=XXXX for domain example.net, path /, expire 0
< Set-Cookie: session=XXXX path=/; domain=.example.net
* Added cookie PHPSESSID=AAAA for domain www.example.net, path /, expire 0
< Set-Cookie: PHPSESSID=AAAA; path=/
* Replaced cookie session=YYYY for domain example.net, path /, expire 0 <
Set-Cookie: session=YYYY path=/; domain=.example.net

Question: WHY is it replacing my cookie XXXX with YYYY? I need my cookie
to be XXXX for logging in to work.

Thanks!
Received on 2007-11-16