Jump to content

Help with require() statement using URL_fopen_wrappers.


r3gan

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??
Link to comment
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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.