473,390 Members | 1,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

remotely including php script output via javascript

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?
Jul 23 '05 #1
3 1321
Tony Rice wrote:
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?


<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.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #2
Randy Webb <hi************@aol.com> wrote:
Tony Rice wrote:
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?


<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.


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/
Jul 23 '05 #3
Ray Morgan <-@Fares-Fair.com> wrote in
news:lj********************************@4ax.com:
Tony Rice wrote:
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?


<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.


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.)


Thanks to both of you for the information. The last part is especially
useful because the PHP script in question outputs "this day in history"
information which is obviously time sensitive.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nick Messick | last post by:
I'm trying to modify a banner display function so it can be including on remote websites. If I just include the file from a remote website the code isn't executed before it is put into the page. ...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
1
by: misdst23 | last post by:
Hi, How do you include javascript in the definition of a jsp TLD. for example if i have a TLD called <mytld: body everytime I include this in a page, I also want some javascript to be included....
3
by: rsteph | last post by:
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work. If I put text between the...
10
by: Robert Huff | last post by:
Can someone offer suggestions why, on the same server (Apache 2.2.8), this works <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <link rel=stylesheet...
4
by: r_ahimsa_m | last post by:
Hello, I am learning WWW technologies in Linux. I created index.html file which I can browse with Firefox/Konqueror using URL localhost/~robert/rozgloszenia/index.html. The page looks fine but...
6
by: Revathi Balakrishnan | last post by:
i am trying to disable some of the anchor tags which are linked with particular onmouseover and onmouseout events.i have written a javascript function.when i called this function on load of the...
7
by: sj071 | last post by:
I'm little more than a novice when it comes to javascript, and this particular problem has been driving me mad for the past few days... The Problem: I have a javascript file that uses...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.