Randy Webb <hikksnotathome@aol.com> wrote:
[color=blue]
>Tony Rice wrote:
>[color=green]
>> I've got a simple php script that dumps some database info out that I would
>> like to make available to others for inclusion on their web pages.
>> Problem is some of them dont have access to PHP or CGI.
>>
>> Would this be possible with javascript?[/color]
>
><script type="text/javascript" src="URLToYourPHPScript.php"></script>
>
>And have the PHP script output it as a script variable, and then the
>client can read the variables.[/color]
Alternatively, if the data on which the script is based doesn't change
too frequently, you can save your server a little work by periodically
writing a static .js file using a cron job. Be sure to serve the
correct http headers with the .js file to indicate when the data will
expire so UAs are advised when to fetch a fresh copy.
On the other hand, since URLToYourPHPScript.php is likely to get
cached, if the data changes in real time and the client must always
receive the latest data, they should append some query string to the
url like "URLToYourPHPScript.php?t=<timeInMilliseconds> ". (The query
string itself isn't used by the PHP script, but it forces a fresh load
of the file.)
--
Ray Morgan
http://Fares-Fair.com/