Page 1 of 1

Import Php in a php Page

Posted: Fri Nov 07, 2003 6:10 am
by NicoBe117
Hi, i'm trying to include some page
in my PHP page.

The page to include is a php page,
that contains some results (this page can be included in other website)

My page is also in PHP, but i experiencing some problems

I have try these codes, i don't see my erros ... so if you can help me
(it doesn't work with html also)

//$file = "http://vbfan.vbhainaut.com/GenClas.php?div=P2BM";

echo $file;

// Load the file into a variable.
$o = fopen($file, "rb");
$c = fread($o, filesize($file));
fclose($o);
echo $c;

// Get stuff between the body tags.
$sA = explode("<body>", $c);
$sB = explode("</body>", $sA[1]);
$contents = $sB[0];

// Echo the contents.
echo $contents;

Posted: Fri Nov 07, 2003 6:41 am
by Gen-ik
Ha. My code is finally getting around I see :)

I'm not 100% sure what you are asking but the code changes have basically killed it. Try this...

Code: Select all

<?

$file = "http://vbfan.vbhainaut.com/GenClas.php?div=P2BM"; 

//echo $file; //what's this here for?

// Load the file into a variable. 
$o = fopen($file, "rb"); 
$c = fread($o, filesize($file)); 
fclose($o); 
//echo $c; //don't need this here.

// Get stuff between the body tags. 
$sA = explode("<body>", $c); 
$sB = explode("</body>", $sA[1]); 
$contents = $sB[0]; 

// Echo the contents. 
echo $contents;

?>

Posted: Fri Nov 07, 2003 6:58 am
by NicoBe117
Ok i'm newbie and i have found the way to force error message
and understand now better my problem

Warning: fopen(): URL file-access is disabled in the server configuration

So anyway thanks for your code Gen-ik !
As i cannot change the config of my hoster, is there an other way to proceed ?

Posted: Fri Nov 07, 2003 7:16 am
by Weirdan
Take a look on CURL extension. This not as simple as fopen, but give it a try.
[php_man]curl[/php_man]