Click to See Complete Forum and Search --> : inbedding pages


hyperstyle
12-29-2003, 06:42 AM
Is it possible to inbed another page in a php page. Like frames but no frames (frames suck arse). I'm sure i have seen this done before.

pyro
12-29-2003, 07:28 AM
include (http://us2.php.net/manual/en/function.include.php), perhaps?

aoeguy
12-29-2003, 09:09 AM
Include can even use FTP url's.

i.e. include('/home/user/abcdefg.php');

hyperstyle
12-29-2003, 09:26 PM
the page i wish to inbed is not on the local server and i have no control over it. The page also links to other pages, which i would like to remain inside the original php page, maybe the original page has to be refeshed to display the new link. scroll bars would also be good. now that i think about it, i don't think i have seen this before

s|k
12-29-2003, 09:44 PM
Originally posted by hyperstyle
the page i wish to inbed is not on the local server and i have no control over it. The page also links to other pages, which i would like to remain inside the original php page, maybe the original page has to be refeshed to display the new link. scroll bars would also be good. now that i think about it, i don't think i have seen this before

You can use file() (http://www.php.net/file) to open up files using a URL. Read the file into a string and then echo or print it to your page. If there is PHP in that file that you'd like to use, you could open the file and the write it to a new file on your server and then include it. Check out the PHP file system library (http://www.php.net/manual/en/ref.filesystem.php) for more information.

Also require_once (http://us4.php.net/require-once) > include (http://www.php.net/manual/en/function.include.php) .

stoodder
12-30-2003, 01:43 AM
yup there are many a-way: try some of these:

require("url");
require_once("url")
include("url")
open("file", readtype);
fopen("file", readtype);

though you have to remmeber with open and fopen that you also need ot read the file, im not exactly a specialist in reading files lol, i do mre along the side of database handling.

aoeguy
12-30-2003, 01:58 AM
I know a bit of file handling :)

$url = "url"
fopen($url,"r");
$content = "fgets($url)";
fclose($url);

there you have all the content in there

pyro
12-30-2003, 07:00 AM
Depending on what you do (and if your server has a decent version of PHP installed for the latter [PHP 4.3.0+]) it would probably be eaiser to user either readfile() (http://us2.php.net/manual/en/function.readfile.php) or file_get_contents() (http://us2.php.net/manual/en/function.file-get-contents.php).

hyperstyle
12-31-2003, 12:54 AM
Thanks guys, I've found the file() function to be exactly what i want, now i can print only the lines that i want :D

I'm having a problem though, the technique used below does not work on the site i intend it for (all other sites that i have tested work fine). I am unable to retrive any page from the kingsofchaos.com domain. I'm guessing they must have something to stop this sort of thing, maybe there is a way around....


$lines = file('http://www.kingsofchaos.com');
foreach ($lines as $line_num => $line) {
print("$line");
}