cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Retrieving page after logging in

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 7 May 2008 07:42:56 -0700

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