cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Retrieving page after logging in

From: <tester_at_spowod.org.uk>
Date: Wed, 07 May 2008 19:51:01 +0100 (BST)

Thanks, but that didn't seem to work.

How am I supposed to provide userid and password fields via cURL to a URL like this

http://abc/login?

And how do I tell if the login was successful?

Dan Fandrich wrote ..
> On Wed, May 07, 2008 at 03:12:57PM +0100, tester_at_spowod.org.uk wrote:
> > I've only just started looking at cURL as a means of retrieving pages
> automatically from a website, but haven't stumbled on the correct way of
> doing what I want. Hopefully, someone point out how it should be done.
> It's such a straightforward task but have been unable to locate an example
> of how to do it.
> >
> > All I want to do is retrieve a page from a website after logging in.
> I need to do this from a Windows cmd file.
> >
> > I presume that all I need to do is issue two calls to cURL, one to login
> and the other to retrieve the page like this:-
> >
> > curl -b cookies.txt -d "login=username&password=password" http://abc/
> > curl -b cookies.txt http://abc/pageid
> >
> > but it doesn't work....
> >
> > What am I missing?
>
> The -c option. -b turns on cookies, but doesn't actually write them to
> the
> file when they come in, so when curl starts the second time, it has no
> cookies to read. Add "-c cookies.txt" and see if that works better.
> There might be more involved, but that's probably the missing piece.
>
> >>> Dan
> --
> http://www.MoveAnnouncer.com The web change of address service
> Let webmasters know that your web site has moved
Received on 2008-05-07