I made a system like this once (yes, to get around the school's blocker. They had mpogd.com blocked. 😛).
I used this:
while(!feof($fp)) {
$page = ereg_replace("href=\"","href=\"http://localhost/bouncer.php?page=".$htPage."/",fgets($fp,128));
$page = ereg_replace("src=\"","src=\"http://localhost/bouncer.php?page=".$htPage."/",$page);
echo($page);
}
There are more efficient ways, I'm sure, but it works. I used sockets rather than include(), also.
If you want the code, you can get it from my website.
Also, I wrote this like a year ago, before I was very concerned about security and all that.. it only works with register_globals on.