This is more a theory question than actual coding problem...
I'm fairly new to PHP and I'm in the process of writing my first PHP data driven site...
www.Rock-Nights.com The site displays event/gigs listings for bands and venues, which all works fine..
A friend of mine runs a similar site, which stores information on venues. What I'd like to be able to do is allow him to display gig listing for a particular venue by pulling the data from my site..
We could do it simply by him linking to a page on my site, but what we'd like to do is for him to generate a page on his site, in the same style as the rest of his site, but include a table that has been pulled from my site.
One way would be to give him a username/password so that he could access my MySQL database and perform the necessary SQL to grab the data. However this about of access is not what I'd like (Not so much for him, but if I can get this working, then I'd be able to offer the ability to other sites).
Another way would be to use frames, and have one of the frames linked to the Rock-Nights site. Again not ideal.
What we'd like to do is as follows...
He writes a PHP script, that generates his own content, then somewhere within the script he references a function stored in a script on my site, which will genereate a list of gigs in a table. I tried 'including' a file from my site on another site, but that doesn't work (my guest is that the web server my end would process the file first and then return an empty file to the requesting site (because the file only has functions in it)).. Like this..
<?PHP
// Crap example that doesn't work, but hopefully explains the concept I'm trying to achieve!
echo "this is a listing example";
include "http://www.rock-nights.com/someexaplefunctions.php";
DisplayGigs(venueid); // Defined in someexamplefunctions.php
echo "Some more content";
?>
I pretty sure it's possible to do something like this, but I'm not sure what kinda direction I should be heading in to sort it out.. Important thing is security, any scripts on my site have to connect to the DB, therefore they have the username/password in them, and therefore shouldn't be 'readable' to the public or the coder on the other sites...
Any hints or information will be a great help!
Vex / Rock-Nights.com