View Full Version : php include using files from another server

12-10-2008, 10:32 PM
I use includes all the time within my php files. The problem I am having is that I want to do an include of a file that on another server (different domain), and it doesn't seem to let me. Is there something I need to do on my end, or something that the remote server manager needs to do, or both?

Help is greatly appreciated. Thank you.

12-11-2008, 12:44 AM
Read this from the manual:

If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.

Also check this link out, it contains an example that may be a better option for your purposes: