Jump to content

using curl to display the content of another site - problem with relative hrefs


webdesco

Recommended Posts

Hi Chaps!

I'm developing a central admin page for my clients website's so as they can administer their guestbook/tarifs/links etc.  It's frame based with the menu in one frame and content in the other and it's working great.  Now what I want to do is have the facility for the clients to view their webstats and hopefully their webmail in the content frame as currently they would have to go the seperate urls and enter the respective user/pass.

 

A chap on my hosting forum suggested I use cURL to 'pull' the pages in.  After some research (as I've never used cURL before) i have this script

curltest.php

<?php
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,"http://www.webdesco.com/webstat/");
    curl_setopt($curl, CURLOPT_USERPWD, "myusername:mypassword");
curl_exec ($curl);
    curl_close ($curl);
   
?> 

The above works fine, BUT none of the images/links work as they are all addressed relatively as can be seen on the following test script http://www.webdesco.com/curltest.php.

 

The chap on the hosting forum mentioned something about preg_replace_callback(), but taking a look at that on php.net has blown my mind  :o

 

Can anyone help please, I'm a novice coder, but willing to learn!

Cheers

Philip

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.