Using a remotely hosted PHP include file
Posted by Voodoochilli | Posted in Development | Posted on 17-02-2007
Tags: PHP, Servers
1
Well here is something I was sure was impossible until the other day. I managed to use a remotely hosted include file in one of my pages. The reason I did this was because all of the coding needed to connect to a database on another site. I think the only reason it worked though is because although the code was on another site, it is on the same server. Still, it worked for me!


Using remote files are aloud you just need to use a wrapper(see previous blog entry).
However,
A remote file may be processed at the remote server (depending on the file extension and if the remote server runs PHP or not) but it still has to produce a valid PHP script because it will be processed at the local server. If the file from the remote server should be processed there and outputted only, readfile() is a much better function to use. Otherwise, special care should be taken to secure the remote script to produce a valid and desired code.