Hi i am wondering how do i include a file that is not hosted on my server.
The file has the PHP code to connect to the users database.
I have made a facebook application and i want to keep the code, but people would like to use my code, so i came up with a hosted server application
I have tryed to use include_once "http://yousite.com/link.php";
and so on but i cant get it to work
Any idea?


should i ask them to host
should i ask them to host the file as an xml file, and then use your xml script to get the data?
Would it still connect to there database?
Hi Russell, I'm afraid that
Hi Russell,
I'm afraid that I don't fully understand the scenario here, but in general - as long as a web server is configured to execute requests ending in .php as a PHP script, there is no way to actually serve the PHP code under those circumstances, as the file is executed by PHP and only the output of the script is returned to the requesting client.
If it is just data that you are looking to provide the external application then your second point is correct - if you create / host that data as an XML document, the content will be served "as-is" (just like an HTML document) for processing as required by the requesting client...
Hope this helps!
Cheers,
David.
Ok follow up question. Say
Ok follow up question.
Say in the XML file it has the username password and the datebase I need to connect to.
How would I get that data to connect to there database?
I think I have an idea but not 100% sure
Hi Russell, That makes
Hi Russell,
That makes sense; because barring firewall or security restrictions at the location (server) from where your script is running, you can connect to any MySQL (i'm assuming) database server on the Internet - it doesn't have to be on your local machine.
So, if the XML you retrieve contains a server name such as:
mysql1234.example.com
...then that value can be used in a call to mysql_connect() just as if you were connecting to "localhost" - all that matters is that your server is allowed to do that!
Hope this helps!
Cheers,
David.