curl-users
Re: Redirect problem?
Date: Thu, 14 Dec 2006 20:44:47 -0800
On Fri, Dec 15, 2006 at 02:52:58PM +1100, Phill Edwards wrote:
> I _think_ the web site works by running start.php which does some sort
> of validation (like checking username and password) and then redirects
> off to a page called member.php - this is where I end up when running
> this in a browser. How can I make this happen through curl? I've tried
> just calling start.php like this:
>
> $ curl --location -s -D - -d "user=987654&password=12345"
> http://www.freecall.net.au/start.php
>
> and I've tried embedding a call to member.php in the call to start.php
> like this:
>
> $ curl -s -b --location "`curl -s -D - -d "user=987654&password=12345"
> http://www.freecall.net.au/start.php | grep Set-Cookie | sed
> 's/Set-Cookie: //'`" "https://www.freecall.net.au/member.php"
>
> While the embedded command does end up at member.php, something isn't
> right because my membership info isn't coming back in the html - it's
> behaving as if the authentication failed and it doesn't know which
> member to display data for.
You're probably on the right track by try to use cookies, but that second
command is a horrendous mess :^) Try enabling curl's built-in cookies
support like this:
curl -b cookies -c cookies --location -s -D - -d "user=987654&password=12345" \
http://www.freecall.net.au/start.php
Or, if necessary, follow that with a read of the members page using the
previously-stored cookies, like this:
curl -b cookies -c cookies --location -s -D - \
https://www.freecall.net.au/member.php
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has movedReceived on 2006-12-15