Re: Chat with php

From: Date: Mon, 07 Oct 2002 18:13:29 +0000
Subject: Re: Chat with php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-119118@lists.php.net to get a copy of this message
Simple trick (well, not so simple, but kind of a Columbus' Egg): 1) Create an <img> tag in your web page that is hidden 2) Point the img tag to a php script that returns: 1) An image with a pixel width of 1 if there is new data to pick up from the server 2) An image with a pixel width of 0 otherwise 3) Create a javascript that refreshes the image every second (or every two seconds, or however often you feel necessary--the more often, the more responsive and "real time" your chat system will be). 4) Add an OnLoad event to the img tag that points to a Javascript that checks the width of the newly reloaded image. If the width is one, then you reload your chat text content (which you may want to put in an iframe to avoid having to reload the whole page). I don't have a script to show unfortunately, as it would probably be too complicated and long for the list (and I have no time to write it...<sigh>), but hopefully, this will give you the gist of it. Cheers, Marco On Mon, 2002-10-07 at 13:43, Oliver Witt wrote: > I attempted to write a oage that you can chat on with php. It ended up > being a page that reloads itself all the time which isn't really what I > wanted. But I didn't know how to do it differently. Is there another > way? I heard something about flush()? > Kind regards, > Oliver > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#119118) next »