note 44378 deleted from function.include by nlopess
| From: | nlopess@php.net | Date: | Wed, 04 Aug 2004 10:00:13 +0000 |
| Subject: | note 44378 deleted from function.include by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73908@lists.php.net to get a copy of this message | ||
Note Submitter: norm@normsworld.co.uk
----
Returning values from a remote include... I tried to do this:
remote_include.php
<?php
$foo = 'bar';
return $foo;
?>
local_file.php
<?php
$bar = include 'http://www.remote.com/remote_include.php';
echo $bar;
?>
It didn't work and I spent ages trying to find out why. It's simple really, but I though
others might slip up on it too. Basically, remote_include.php is parsed by the remote server and so
only gives back HTML... Change remote_include.php to this and it works:
<?php
echo "<?php \n";
echo " \$foo = 'bar'; \n";
echo " return \$foo; \n";
echo "?> \n";
?>