Possible to include files from my server on another?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bwv2
Forum Commoner
Posts: 83
Joined: Fri Jun 10, 2005 11:50 am
Location: AZ

Possible to include files from my server on another?

Post by bwv2 »

I have created a web-based tool that takes users through a series of pages and presents them with their results on a results page. It relies on databases stored on my server, and currently resides on my own dedicated server.

I will be licensing the tool to another company to have it be accessible on their website, for their customers to use. I need to be able to edit the code from time to time to keep the tool up to date. Thus, I need to basically include my program's pages (steps) on their server, while keeping the databases and pages on my server (they're many many gigabytes in size). I have an idea of the solution, but don't know if it's possible:

--create all of the pages on their server with only headers and footers (blank space in body)
--Add one include() statement in the body of each page to pull my content from my server into their pages.
--Make calls to my databases for the queries


Is it possible to use include() to pull files from a different server? Also, can I pull database queries from another server? If anyone has a better solution, please let me know. It would be VERY beneficial not to have to physically place my pages on their website, as the tool will be licensed to as many as 100 companies, and I don't want to have to update each company's website every time I change something.
User avatar
Jaxolotl
Forum Contributor
Posts: 137
Joined: Mon Nov 13, 2006 4:19 am
Location: Argentina and Italy

Post by Jaxolotl »

From Manual http://www.php.net/include
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 Appendix O, 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I'd rather write an update script as part of your application that fetches the changes you've made from your server and updates the customers' local database and/or scripts.
User avatar
Jaxolotl
Forum Contributor
Posts: 137
Joined: Mon Nov 13, 2006 4:19 am
Location: Argentina and Italy

Post by Jaxolotl »

volka wrote:I'd rather write an update script that fetches /and pulls) the changes you've made and updates your customers' database and/or scripts.
I agree, it's cleaner a more secure. (think about the server where there is the file to include goes down, or the file is edited by someone else)
Post Reply