cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl command line and login to phpbb forum

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Wed, 23 Jul 2008 08:56:33 -0500

On Wed, Jul 23, 2008 at 8:22 AM, Oren Amsalem <oren_amsalem1_at_hotmail.com>
wrote:

> thanks but
>
> curl -d password=pass -d username=user -d redirect= -d login=Log+in -c
> cookiefile.txt -b cookiefile.txt http://link/login.php
> give not result
>
> This one
> curl -d password=pass -d username=user -d redirect= -d login=Log+in -c
> cookiefile.txt -b cookiefile.txt http://link/login.php
> give back
>
> curl: (6) Could not resolve host: password=pass; Host not found
>
> But how can he use the cookies if he just now get them?

Those two command lines look the same to me.

Are you fetching the login page first, then doing the post, or are you just
jumping right in and posting the login details?? I've found that I often
get some kind of cookie while fetching the login page, so I generally do
something like:

     curl -b cookies -c cookies -s -S -L -o home_page.html
http://server.domain.com/

     curl -b cookies -c cookies -s -S -L -o logged_in.html -d .... -d .....
http://server.domain.com/xxx

Even if you don't get a cookie with the first page fetch, it's possible the
server is checking the "Referer" header to see if you went to the login page
first.

Ralph Mitchell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2008-07-23