Longlands Posted April 30, 2008 Share Posted April 30, 2008 I have a script that needs to run a routine on a different server. The reason is so that I can update that small part of the code without users needing to install a script upgrade every so often. It is easy enough to pass variables to the remote script: include 'http://www.remotedomain.com/script.php?var=$var The remote script calculates and creates an array, but try as I might, I haven't been able to get it to send the array back. I've tried using return($x); in accordance with what I've read in the PHP Manual, but it didn't seem to work. Is this even possible? Martin Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 30, 2008 Share Posted April 30, 2008 Including a remote file is the same as browsing to it. You only get any output that is echoed. Using return() in an include file only has meaning if that file is included locally. To get an array from the remote server would either require you to output "raw" php code, including the surrounding <?php and ?> tags that sets the values in an array or to serialize the array, output the serialized string, capture it on the local server, and un-serialize it. Edit: Using file_get_contents() instead of include() would make using the serialize/un-serialize method easier and safer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.