deecee2000 Posted October 30, 2009 Share Posted October 30, 2009 Hi All, I want to include other(remote) server's PHP file in my current server. I tried below command, but it is not working. include('http://www.server2.com/index.php'); My Server1 Settings are: allow_url_fopen = On allow_url_include = On I can't access any variable from server2 php file in current file. Can anyone please focus how do I handle this? Thanks in Advance. Deecee Link to comment https://forums.phpfreaks.com/topic/179693-how-to-include-php-file-from-another-server/ Share on other sites More sharing options...
trq Posted October 30, 2009 Share Posted October 30, 2009 When you include a file from a remote location it is processed on the remote server and the output is included within your script. You cannot gain access to variables, functions or classes that way. Link to comment https://forums.phpfreaks.com/topic/179693-how-to-include-php-file-from-another-server/#findComment-948112 Share on other sites More sharing options...
deecee2000 Posted October 30, 2009 Author Share Posted October 30, 2009 Yes that's true... If I use below code in server2(remote), I can able to see output in my server1. server2 php file. echo $test = "ABC"; And if I include this file in my server, it is showing "ABC" as output. But my is there any way I can see output if I echo this $test variable in my server php file? In other words how can I access any variable from remote server to my server? Thanks, Link to comment https://forums.phpfreaks.com/topic/179693-how-to-include-php-file-from-another-server/#findComment-948116 Share on other sites More sharing options...
trq Posted October 30, 2009 Share Posted October 30, 2009 In other words how can I access any variable from remote server to my server? Put simply, you can't. Link to comment https://forums.phpfreaks.com/topic/179693-how-to-include-php-file-from-another-server/#findComment-948119 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.