...

View Full Version : Simple Question



Mulsiphix
06-23-2005, 06:22 PM
I do not know PHP and while I would love to learn it some day I do not have the time to do so right now. I did a little searching for this question and found nothing. Question:

Is there a way to create a php file which will display whatever URL I specify in it? Not a redirection like I already know how to achieve with HTML. I want this php file to display the contents of whatever URL I plug into it. Is this possible?

Please note iframes are not acceptable as they are currently only supported by IE. I need something that will work with the top three to four browsers available today.

delinear
06-23-2005, 09:46 PM
There's no simple way to do this as far as I know. You can include() a url if url wrappers are open in the PHP ini, but then unless the page you include uses absolute url's for every link and image therein it will look pretty broken. For instance, if you did:

<?php
include_once("http://www.google.com");
?>
You will see what I mean, you get the basic page layout but the images are missing and if you try and do a search, because the link is relative to the server the page is on, it will break.

The only way I can think to do this is to use some kind of regex to parse the entire page and to re-write all the links so that they're absolute rather than relative, but that's a lot more complex a solution that you wanted I guess.

faxie
06-23-2005, 10:07 PM
find out about the window frames technology. :thumbsup: ;)

Kurashu
06-24-2005, 01:16 AM
Please note iframes are not acceptable as they are currently only supported by IE. I need something that will work with the top three to four browsers available today.

o.O What are you smoking? Last I checked iframes were supported by most browsers.

gsoft
06-24-2005, 01:29 AM
I wouldnt suggest using that include_once not exactly the smartest thing to do and I dont think you will be able to regex it why not use fsockopen so then you have it in a string then can make sure pages display correctly. An example



<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";

fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>


From the Manual.

Dave96
08-27-2005, 10:56 PM
This also messes up the display. Is there any way of using fsockopen() and not having all links relative?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum