Using eval() isn't working
Posted: Tue Aug 23, 2005 6:15 pm
Hi,
Never used eval() before so maybe I'm doing something wrong here....
I'm trying to read the contents of a PHP script which by itself echo()'s content to the page. I need to somehow read the output from within another script and store it in a string. I don't want to have to use shell access or use local loopback with apache.
I figured that somehow eval() would be a tasty option here but it seems to reject anything I throw at it..
The code I want to eval() - in another file
and...
The file I'm trying to do it from
Cheers,
d11
Never used eval() before so maybe I'm doing something wrong here....
I'm trying to read the contents of a PHP script which by itself echo()'s content to the page. I need to somehow read the output from within another script and store it in a string. I don't want to have to use shell access or use local loopback with apache.
I figured that somehow eval() would be a tasty option here but it seems to reject anything I throw at it..
The code I want to eval() - in another file
Code: Select all
<?php
$foo = 'bar';
echo $foo;
?>The file I'm trying to do it from
Code: Select all
<?php
$output = eval(file_get_contents('path/to/the/file.php'));
$ret = 'Foo'.$output;
echo $ret;
?>I've also tinkered around with output buffering with little luck. If anyone knows what I'm doing wrong or a way to do it better please say (I do need to get the output from the other file either way).The error message wrote:Parse error: parse error, unexpected '<' in /home/d11wtq/public_html/shane2/sys/core/core.class.php(327) : eval()'d code on line 1
Cheers,
d11