r3gan Posted July 31, 2006 Share Posted July 31, 2006 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?? Quote Link to comment https://forums.phpfreaks.com/topic/16107-help-with-require-statement-using-url_fopen_wrappers/ Share on other sites More sharing options...
wildteen88 Posted July 31, 2006 Share Posted July 31, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16107-help-with-require-statement-using-url_fopen_wrappers/#findComment-66387 Share on other sites More sharing options...
r3gan Posted July 31, 2006 Author Share Posted July 31, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/16107-help-with-require-statement-using-url_fopen_wrappers/#findComment-66465 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.