php tremote includes need help
Posted: Fri May 09, 2008 6:10 am
When including a remote php file, for some reason the code inside the file cannot be executed.
The file is included without error. fopen wrappers are enabled in the php.ini
i.e. I have a functions file on local server 1. Its URL is http://192.168.x.x/functions.php
The contents of this file contain lets say:
<?php
function myFunction() {
return "hello world";
}
?>
I want to include this file into a script on local server 2 into a file called test.php
So:
<?php
include(http://192.168.x.x/functions.php);
print myFunction();
?>
Instead of the string hello world being displayed I get Call to undefined function myFunction in .........
I know the file is included because if I change the include to include(http://192.168.x.x/func.php); - a file that does not exist I getthe usual file not found error.
Also I can read the contents of a text file on the remote server no problem i.e.
<?php
print_r(file_get_contents(http://192.168.x.x/test.txt));
?>
This is baffling me!
The file is included without error. fopen wrappers are enabled in the php.ini
i.e. I have a functions file on local server 1. Its URL is http://192.168.x.x/functions.php
The contents of this file contain lets say:
<?php
function myFunction() {
return "hello world";
}
?>
I want to include this file into a script on local server 2 into a file called test.php
So:
<?php
include(http://192.168.x.x/functions.php);
print myFunction();
?>
Instead of the string hello world being displayed I get Call to undefined function myFunction in .........
I know the file is included because if I change the include to include(http://192.168.x.x/func.php); - a file that does not exist I getthe usual file not found error.
Also I can read the contents of a text file on the remote server no problem i.e.
<?php
print_r(file_get_contents(http://192.168.x.x/test.txt));
?>
This is baffling me!