Import Php in a php Page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NicoBe117
Forum Newbie
Posts: 2
Joined: Fri Nov 07, 2003 6:10 am
Location: Belgium
Contact:

Import Php in a php Page

Post 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;
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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;

?>
NicoBe117
Forum Newbie
Posts: 2
Joined: Fri Nov 07, 2003 6:10 am
Location: Belgium
Contact:

Post 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 ?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Take a look on CURL extension. This not as simple as fopen, but give it a try.
[php_man]curl[/php_man]
Post Reply