cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: how to click a link and download an image

From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Wed, 24 Aug 2005 14:57:56 -0400

On 8/24/05, leegold <leegold_at_fastmail.fm> wrote:
> On Wed, 24 Aug 2005 14:30:13 -0400, "Lars Nilsson"
> <chamaeleon_at_gmail.com> said:
> > 1. Get first page
> > 2. Parse HTML for first page and extract url for second page
> > 3. Get second page based on extracted url
> > 4. Parse HTML for second page and extract url for jpeg
> > 5. Get jpeg
> >
> > Now you can just fill in the specifics. ;) libcurl only provides you
> > with the tools to do step 1, 3 and 5. It is your responsibility to do
> > the things that do not involve the transfer of data from the server to
> > your program (which includes figuring out what to do with the HTML
> > code and extract any relevant information, etc).
>
> This helps!!!
> So steps 2,4 involve regex and text processing - OK excellent.
> 1,3 are seem well documented on the haxx site.
> But 5 - what would be the curl command? I see upload cmds in the man but
> didn't see a download cmd...I now see another utility called wget, but
> would prefer curl if there's way?
>
> Thanks so much,
> Lee G.

5 is no different from 1 or 3. "curl -o <filename> <url>" (plus any
options that may be required to satisfy the web server) will work fine
for both the html and jpeg files.

Lars Nilsson
Received on 2005-08-24