local.php runs on server A
remote.php runs on server B
I need to invoke romote.php from within local.php and I need to pass back information from remote.php to local.php
local.php on server A:
Code: Select all
<?php
$var_local = include 'http://www.serverb.com/folder/remote.php';
echo $var_local;
?>Code: Select all
<?php
$var_remote = 'test';
return $var_remote;
?>but instead it outputs: 1
(the 1 simply indicates that the include was successfull)
here's the php documentation: http://www.php.net/manual/en/function.include.php
so it should work I think...Handling Returns: It is possible to execute a return() statement inside an included file in order to terminate processing in that file and return to the script which called it. Also, it's possible to return values from included files. You can take the value of the include call as you would a normal function. This is not, however, possible when including remote files unless the output of the remote file has valid PHP start and end tags (as with any local file). You can declare the needed variables within those tags and they will be introduced at whichever point the file was included.
I also tried:
local.php on server A:
Code: Select all
<?php
include 'http://www.serverb.com/folder/remote.php';
echo $var_remote;
?>what's wrong - or do you know another way to pass information back to local.php ?
thank you!