hi...

is this a php/web based app...
are the users using the chat function via the browser..
if this is a browser/web app, are you looking for a way for the
 php web app to refetch the textfile... i would assume so...

have you figured out a rough architecture/design for your app..
in your design, you're going to need to figure out how to
 accomplish updates to the text file, and when you do, you'll
 also have figured out how to do the reads...

i'm assuming that you don't want a continuously running thread
 for your php/web app.. ie one continuously, never ending loop...
 -so you'll have the user add some text, the app will write this to
  a file..
 the user will either select a refresh kind of btn, or your
 app will have to implement a refresh process, which will then
 fetch new/updated data from your files..
 etc...






-----Original Message-----
From: richard.he...@gmail.com [mailto:richard.he...@gmail.com]on Behalf
Of Richard Heyes
Sent: Saturday, June 13, 2009 2:17 AM
To: Parham Doustdar
Cc: php-general@lists.php.net
Subject: Re: [PHP] Periodic Actions in PHP?


Hi,

> I'm going to create a small chat script with PHP. The messages you want
others to see
> will be added to a flat file (I.E. TXT file), and read and displayed by
PHP. However, I want
> this reading and displaying to be periodic. This means that I want PHP to
check the file for
> new lines every,say, fifteen seconds. How may I do that? I have been
unable to find any
> function that acts like a timer.

If you're on Unix then look into using cron. Type the following at the
command prompt to get info on cron:

man 5 crontab

Cron tasks can be scheduled at most once per minute. And if you're
using Windows then I believe the equivalent would be task scheduler,
but I've no idea how you would go about using it.

--
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to