cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Relative URLs

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 29 Oct 2002 11:20:11 +0100 (MET)

On Tue, 29 Oct 2002 ken_cathcart_at_royalsun.com.au wrote:

> My problem is in downloading a page using the script below. I get the page
> OK, however all the relative URLs to the images on the page are broken.

I think you've misunderstood that curl does. It transfers the data. It does
not alter it in any way.

The relative URLs in the data you wanted are exactly the same as they were on
the remote site you fetched the data from.

> The host portion of the image URLs are addressed using apache 2 server
> (were the script is run from) in place of the target URL host portion. I
> thought the CURL_REFERER would solve my problem...

The REFERER is for setting the Referer: field in the HTTP request. It doesn't
change any HTML.

> So... a relative URL on the page named
> "images/bla/bla/image.gif"
> is addressed... http://my-php-server/images/bla/bla/image.gif
> instead of... http://www.royalsun.com.au/images/bla/bla/image.gif

You'll need to parse the HTML and change it if this is what you really need.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-29