cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: newb question: cookies w/ post

From: Dennis Falling <dfalling_at_mac.com>
Date: Tue, 15 Feb 2005 13:06:25 -0600

Great, thanks a lot! That's more help that I ever would have expected,
I really appreciate it.

-dennis

On Feb 15, 2005, at 2:26 AM, Ralph Mitchell wrote:

> In a nutshell - you should start from the very first page you'd expect
> a browser user to start at. Catch and return cookies on every command
> line. Save each page and check it over. Post back *all* form
> elements, including the "submit" input field, if it's named.
>
> I generally use a command line that looks a lot like this:
>
> curl -b cookies -c cookies -s -S -L -o output.html <url>
>
> or
>
> curl -b cookies -c cookies -s -S -L -d "somepostvars" -o
> output.html <url>
>
> That should go a long way towards navigating most sites.
>
> In your particular case, it looks like the site sends you a couple of
> cookies when it displays the login form. You're jumping right in and
> posting to the login page *without* those cookies, so it thinks you
> have cookies disabled. You should hit the page twice - first time to
> get (and save) the cookies, second time to perform the login:
>
> curl -b cookies -c cookies -s -S -L -o page1.html
> https://my.netspace.net.au/
>
> curl -b cookies -c cookies -s -S -L -o page2.html -d
> "username=elroyel1327&password=woo&Next=Submit"
> https://my.netspace.net.au/logincheck
>
> That gets me as far as "Your username or password is incorrect, please
> try again."
>
> You're not posting back all the form variables, either. There's one
> called "dest" that seems to be set to the page (dest="/logincheck")
> and another that sets the "remember me" flag. They might not matter
> in this particular site, but that's something you'll find out by
> experimenting with it...
>
> Ralph Mitchell
>
>
> On Tue, 15 Feb 2005 00:02:27 -0600, Dennis Falling <dfalling_at_mac.com>
> wrote:
>> Ok, clearly I'm not as knowledgeable about these things as you expect
>> me to be. Any advice on where to go to learn what I need to do this?
>> I don't even know where to start (I thought this was a good starting
>> place, but I guess I was wrong.) If you could just point me in any
>> direction (right or wrong), I'll be happy.
>>
>> Thanks,
>> -dennis falling
>>
>>
>> On Feb 14, 2005, at 1:37 PM, Daniel Stenberg wrote:
>>
>>> On Mon, 14 Feb 2005, Dennis Falling wrote:
>>>
>>>> What do you mean that I don't follow locations? The primary login
>>>> page is <https://my.netspace.net.au/>, but I'm using the page that
>>>> it
>>>> redirects the post to <https://my.netspace.net.au/logincheck> to
>>>> send
>>>> the info to.
>>>
>>> http://curl.haxx.se/docs/manpage.html#-L--location
>>>
>>>> As far as the cookies, do I need to access the first page to get the
>>>> cookie, then when accessing the second page with the login info, use
>>>> that cookie?
>>>
>>> Perhaps. You need to find out.
>>>
>>> --
>>> Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
>>> Dedicated custom curl help for hire: http://haxx.se/curl.html
>>>
>>
>>
>
Received on 2005-02-15