High, I'm new to PHP (and all server side scripting), but I was wondering if anyone can help me with this problem:-

I'm using a PHP script developed by MC4.com which is a simple script to grab elements of any other web page on the net. What I want to use it for is to take headline links from other sites and place them in my site - which then link back to the specific articles on the source site. This works fine if the headline links I'm grabbing are absolute links, but will not work from my site if they are relative links.

The script is as follows:

<?
########################
## Mandatory Setting ##
########################

$GrabURL = "URL to fetch"; //- Complete URL of the page your grabbing from!
$GrabStart = "Start grab here";
$GrabEnd = "End grad here";

#############################
## Do Not Edit Below Here ##
## Do Not Edit Below Here ##
#############################
$file = fopen("$GrabURL", "r");
$rf = fread($file, 20000);
$grab = eregi("$GrabStart(.*)$GrabEnd", $rf, $printing);
// $printing[1] = str_replace("", "", $printing[1]); Un-Comment This Line for "Replace" purposes!
fclose($file);
echo $printing[1];
echo "&nbsp;&nbsp;<font face=Verdana size=1>Script Provided By: <a href=\"http://www.4cm.com/\" target=\"_blank\">www.4cm.com</a></font>";
####################
## End of Script ##
####################
?>

Now my question is:
How do I modify this script so that it automatically changes the relative links it fetches to absolute links?

I know this is probably a real challenge - but I'm sure there are a few of you PHP geniuses out there who could probably figure it out.

I'd be eternally grateful if anyone could figure out a solution.