RE: [PHP] Automatic Change without reload button
| From: | Andrew Braund | Date: | Sat, 16 Sep 2000 05:06:37 +0000 |
| Subject: | RE: [PHP] Automatic Change without reload button | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-17010@lists.php.net to get a copy of this message | ||
A while ago I saw a web page explaining a system (written in Perl I
think) that was used to show a presentation to a number of different
sites simultaneously (and synchronised). A presenter was a the main
site and the browsers at 4 other remote sites would display the same
page the presenter was viewing on his web browser as he went to various
sites. I think it worked using multipart Content-type.
Unfortunately I have lost the URL to the explanation of how it was
done.
I have been experimenting with
<?php
header("Content-type: multipart/mixed;boundary=ThisRandomString");
print("\n");
print( "--ThisRandomString\n");
print("Content-type: text/html\n");
print("\n");
print( "First update at ");
echo date("H:i:s");
print("\n\n");
print( "--ThisRandomString\n");
flush();
sleep( 5);
print("Content-type: text/html\n");
print("\n");
print( "Second update at ");
echo date("H:i:s");
print("\n\n");
print("--ThisRandomString--\n");
?>
but it doesn't work :-(
If anyone knows how to get this working, I would love to know.
Regards
Andrew Braund
> -----Original Message-----
> From: joarmc@swbell.net [mailto:joarmc@swbell.net]
> Sent: Saturday, 16 September 2000 12:02
> To: Pepen
> Cc: php-db@list.php.net; php-general@lists.php.net
> Subject: Re: [PHP] Automatic Change without reload button
>
>
> On Sat, 16 Sep 2000, Pepen wrote:
>
> > Hi Everyone,
> >
> > how to make a page that view data from MySql table that the data
> > is automatic change if the the content of table was change, without
> > press the reload button in browser
> >
> > Thank's
> > Pepen
>
> Well, the base answer is, "You can't do that." Not entirely true, of
> course. When a person goes to your web site, each interaction is
> separate. There is no permanent TCP/IP connection. So you
> don't have a way
> to send another page to them until they request it. Now,
> what you could
> do, is have your page send a Java program to the remote
> site. This Java
> program would then open a socket to a server at your site. When your
> server tells the Java program that the database has been
> updated, the Java
> program on the client would then request the data and
> display it. This
> would really be more or less independant of your Web page and their
> browser. The other thing you might be able to do is have a
> small Java or
> JavaScript program which would do an automatic refresh from
> the client
> side. But there is NO way for the Web server to contact the
> client's browser
> except when the client requests it.
>
> John
>
> P.S. no, I don't know how to write such a client-side
> requestor, sorry.