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

curl-and-php

Relative URLs

From: <ken_cathcart_at_royalsun.com.au>
Date: Tue, 29 Oct 2002 12:23:28 +1000

Hi,

I'm currently using PHP 4.3, Apache 2 and libcurl 7.8.9.

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.

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...

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

I want to use the Statistics of Curl (curl_getinfo()) to benchmark the web
page so that I can trend connection time and the total size of the page
including images.

I have searched for an answer for this for days....can anyone help ???

Thanks & Regards

Ken

   $url = "http://www.royalsun.com.au";
   $ch = curl_init ($url);
   curl_setopt ($ch, CURLOPT_REFERER, $url);
   //curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_VERBOSE, true);
   curl_setopt($ch, CURLOPT_HEADER, 1);
   curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
   curl_exec ($ch);

CAUTION - This message is intended for the addressee named above
It may contain privileged or confidential information. If you are not the
intended recipient of this message you must not use, copy, distribute or
disclose it to anyone other than the addressee. If you have received
this message in error please return the message to the sender by
replying to it and then delete the message from your computer.

Internet emails are not necessarily secure. Royal & SunAlliance does not
accept responsibility for changes made to this message after it was sent

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-29