get php file content, please help.

magames

New Member
Messages
22
Reaction score
0
Points
0
i want to get the content of php file and not the script so i use this code:

PHP:
$from = "http://magames.pcriot.com/index.php"; //for exemple.
$handle = fopen($from, "rb");
$contents = '';
while (!feof($handle)) {
  $contents .= fread($handle, 8192);
}
fclose($handle);
by this way i will use high server resource usage,
So is there in other way to do this please :happysad:
 

magames

New Member
Messages
22
Reaction score
0
Points
0
please this is not what i want
for example index.php contents is <? echo "hello"; ?>
if i use file_get_contents('index.php'); i will get [<? echo "hello"; ?>] in ~0.0001 sec
but if i use file_get_contents('http://magames.pcriot.com/index.php'); i will get [hello ] in ~0.14 sec

i want to get [hello] without open index.php from http://magames.pcriot.com .

IF ITS POSSIBLE
 
Last edited:

ahsankhatri

New Member
Messages
2
Reaction score
0
Points
0
u can get hello from u wrote :happysad:

but if i use file_get_contents('http://magames.pcriot.com/index.php'); i will get [hello ] in ~0.14 sec
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
please this is not what i want
for example index.php contents is <? echo "hello"; ?>
if i use file_get_contents('index.php'); i will get [<? echo "hello"; ?>] in ~0.0001 sec
but if i use file_get_contents('http://magames.pcriot.com/index.php'); i will get [hello ] in ~0.14 sec

i want to get [hello] without open index.php from http://magames.pcriot.com .

IF ITS POSSIBLE

You need to use include('index.php'); in that case. include() will parse/execute the php file on the server similar to if it was being requested by someone through http.

However, if you want to store "hello" in a variable instead of having it output to the user, you need to use output buffering:

PHP:
<?php
ob_start();
include('index.php');
$output = ob_get_clean();
?>
This will store "hello" in $output.
 
Top