cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to access a link within a web page

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 2 Apr 2004 10:53:41 +0200 (CEST)

On Thu, 1 Apr 2004, simon wu wrote:

> With the curl command line tool, I can access a web page, send login user
> and passwd etc. However, I couldn't figure out to to access a link inside
> the page.

curl doesn't automaticly download links from "inside the page". curl has no
knowledge of HTML and doesn't try to understand it.

You need to tell it what to download!

> For example, after running:
> >curl http://pcaryy1a
> I got:
> ...
> <a href="/mobilelocator/servlet/MobileLocator?reqtype=showDetailsPage">
> ...
>
> How can I access the href page?

curl
"http://pcaryy1a/mobilelocator/servlet/MobileLocator?reqtype=showDetailsPage"

> I tried the -e option but couldn't figure it out.

-e sets the Referer: field in the request.

> Can you do the main page and ref page in one command line?

Sure, but then you must already know what link(s) you want. Like this:

 curl http://pcaryy1a
"http://pcaryy1a/mobilelocator/servlet/MobileLocator?reqtype=showDetailsPage"

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-02