Fetch a webpage locally
| From: | Mark McIntyre | Date: | Sun, 17 Dec 2000 04:47:31 +0000 |
| Subject: | Fetch a webpage locally | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30707@lists.php.net to get a copy of this message | ||
Well, I need to write a php script to fetch a remote webpage and display it on
a local server (provided it meets certain critera). Me and my entire hour of
previous PHP experience thought it would be a good idea to take on this task.
A simple self-smack on the head taught me that this wasn't as easy as I had
planned.
Here was my plan:
$page = join ('', file ($url));
[ check for 'criteria' here, and if all's well...]
echo $page;
Naturally, my main problem is that the links and images don't work. (duh!)...
So, now I need a way to have the external links re-route back to my script,
and alter the <img> tags to reflect the documents new location. Since any of
these may or may not be document relative, this has turned into quite a task
for me.
I'm in over my head...
If anyone has done this before, or knows where I can start, please help me. It
will be greatly appreciated. :)