I am trying to use php's "include" to include a script that's on a separate server.
For example purposes the file's name is "library.fn.php" located at www.example.com/functions/
library.fn.php has the function userName().
I need to call the function that's in "library.fn.php" from www.newexample.com.
In my index.php for newexample.com I have:
Code PHP:<?php include 'www.example.com/functions/library.fn.php'; userName(); ?>
When I run www.newexample.com I receive the error stating userName() is undefined.
To make sure the code indeed included library.fn.php I added an echo statement to library.fn.php and the echo statement printed fine when you refresh www.newexample.com. However, the functions are still undefined.
How can I use a function that's in a file on another server?
I tried:
fopen("http://www.example.com/functions/library.fn.php/", "r");
readfile('http://www.example.com/functions/library.fn.php/');
file_get_contents('http://www.example.com/functions/library.fn.php/');
BTW my "URL fopen wrappers" are set to "On" in my php.ini file







Bookmarks