cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl with the follow re-directs option.....

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Thu, 28 Oct 2004 01:32:41 -0500

I've had some success pasting a "Base href=xxx" tag onto the front of
the downloaded html. Something along these lines:

     effective_url=`curl $STDOPTS \
          -w "%{url_effective}" \
         -o page \
         http://server.domain.com`

     BASEURL=`dirname $effective_url`
     cat page | \
           sed -e "s;<HEAD>;<HEAD><Base href=\"$BASEURL\">;" \
> page.html

Your browser sees the "Base href=xxx" and uses it to prefix relative urls.

Ralph Mitchell

On Wed, 27 Oct 2004 16:45:03 -0400, HART, CHRISTOPHER T
<christopher.t.hart_at_bankofamerica.com> wrote:
>
> The URL you're requesting returns HTML with relative paths. As a result, if
> you open the resulting output in a browser, it won't know where to go for
> the images or stylesheets. You could try parsing the HTML after you run
> curl to try to replace relative paths with the correct absolute paths.
> However, if you're goal is to have everything to display the page local, you
> would need to also instruct curl to download all those supporting files (in
> which case you could recreate the pathing locally to get the page to display
> correctly).
>
> Chris
>
>
>
> -----Original Message-----
> From: curl-users-bounces_at_cool.haxx.se
> [mailto:curl-users-bounces_at_cool.haxx.se]On Behalf Of Dutcher, John
> Sent: Wednesday, October 27, 2004 4:29 PM
> To: 'curl-users_at_cool.haxx.se'
> Subject: curl with the follow re-directs option.....
>
>
> When the -L is combined with the -O option a particular
> page is indeed located and saved via redirection with this
> command----> curl -L -O epaces.html https://www.emedny.org/epaces
>
> However epaces.html doesn't display in a browser the same as if retrieved by
> the
> browser itself.......namely no .gifs and coloring are present.
>
> Is this as expected ??
>
Received on 2004-10-28