Forum Moderators: coopster
File on server 1: [example1.com...]
<?php
$path = "http://www.example2.com/";
require $path."file2.php";
TestFunction();
?>
File on server 2: [example2.com...]
<?php
function TestFunction(){
echo "Test works";
}
?>
When i call [example1.com...] i get the following error:
Fatal error: Call to undefined function: TestFunction()
Is there a way i can do this? or any suggestions on how to protect my logic simply and easily?
As gcarn said, the file will be parsed on the other sever before it is sent over in the include. In order to do this you'd have to get rid of the .php extension so it isn't parsed as PHP on the remote server, however, this will enable other people to see the source code for that particular PHP file on the server. If this is something you are willing to have then try this approach, otherwise, it's best to make a copy of the file on the other server and put it in the includes directory on the server you need the function definitions in.