Jump to content

Archived

This topic is now archived and is closed to further replies.

r3gan

Help with require() statement using URL_fopen_wrappers.

Recommended Posts

Can anyone give me some help on using a require() statement to include a PHP script from a different machine?  I am able to call & run the script via the require() statement because there are print() statements in the remote script that are echoed to the browser when I run my page, however I cannot get it to return anything from the remote script back to my local script.  The remote script is a .php extension and the remote machine is configured to parse PHP scripts, so the code is being processed on the remote machine.  How do I set up that remote script so that it will pass results / variables back to my calling script that I can use??

Share this post


Link to post
Share on other sites
Require doesnt execute the code on the remote machine, instead it basically copy 'n' paste's the contents of the file being included/required into the script that is getting the file.

Share this post


Link to post
Share on other sites
The copy & paste idea works for local files being required, however it doesn't seem to behave the same way for my remote file.  Here's the setup:
[pre][size=10pt]-------------------------------------------------------------------------
Local file:
<?php
//
// some php code here
//
require("http://www.example.com/myDir/myFile.php");
if (isset($myVar))
  print $myVar;
else
  print "variable does not exist";
?>
-------------------------------------------------------------------------
Remote file:
<?php
$myVar = "variable exists";
?>
-------------------------------------------------------------------------[/size][/pre]

The example above prints "variable does not exist".  So the variable being created in the remote script is not sent back for use in the local php script.  Am I doing something wrong?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.