php: waiting for other slow websites
David Kramer
david-8uUts6sDVDvs2Lz0fTdYFQ at public.gmane.org
Tue May 29 20:40:48 EDT 2007
Eric C wrote:
> hi all. i'm using data from other folks websites on
> my website. when a user views my page i update the
> database and then display it to the visitor.
> unfortunately the websites i get info from are really
> freakin slow sometimes. i would like to gather the
> info independent of the visit. it's on a lazy managed
> host. can somebody offer a keyword or two to google
> with to give me a clue? - eric c.
What I think you need is to use one of the techniques for updating a web
page dynamically, like REST or AJAX. The basic idea is that you create
the dynamic parts of your page with some sort of <div> or other block
tag with an id set. Then you have a JavaScript function (called by
onload) get the content from the other site using XmlHTTPRequest().
When it gets the content, it sets those <div> (or whatever) blocks to
that content. But the point is that the page paints without first
waiting for the dynamic content. It's all asychnronous. And you can
set those <div> blocks to some sort of "please wait..." message until
the data gets there.
Google for "AJAX" (more "hot" and "now" and flexible) and REST (easier)
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Discuss
mailing list