I am remotely including files on a website by calling their absolute URLs. I am creating arrays inside of these included remote files which I need to use on the client-side page. However, thus far I have been unsuccessful in passing the arrays created in the remote files back to the script. Here's an example of what's happening:
Code: Select all
/*---remoteFile.php---*/
$theArray = array();
//here I successfully pull many rows from a mySQL database and assign them to $theArray...I'll spare the code
return $theArray;
//----------------------//
/*---clientFile.php---*/
$showIt = include("http://www.mysite.com/includes/remoteFile.php?arguments=$args");
print "Array: ".$show;
//prints: "Array: 1"
//----------------------//
The number 1 is printed to the screen because it's saying the include() operation was successful. If it had sent back my array it would have printed "Array: Array". I have also tried it with non-array values such as $foo="it works", etc.
Any idea why this might not be working? I have also tried assigning the text of remoteFile.php to a variable using:
Code: Select all
$showIt = file_get_contents("http://www.mysite.com/includes/remoteFile.php?arguments=$args");
echo $showIt;
This does work to create tables and whatever else I put in the file, but I can't use the variables created within it on the client side. Any clues?