Re: Periodic Actions in PHP?

From: Date: Sun, 14 Jun 2009 20:46:41 +0000
Subject: Re: Periodic Actions in PHP?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-294033@lists.php.net to get a copy of this message
Sleep(). ? Bastien Sent from my iPod On Jun 14, 2009, at 13:52, "Parham Doustdar" <parham90@gmail.com> wrote:
Actually, your message sparked an idea in my [slow] mind. :) I can put the PHP code in a java script, and tell javascript to call it every fifteen seconds. Best option, I think. :) Any ideas? Thanks! ----- Contact info: Skype: parham-d MSN: fire_lizard16 at hotmail dot com email: parham90 at GMail dot com ""bruce"" <bedouglas@earthlink.net> wrote in message news:1528701c9ec4d$322e6cb0$0301a8c0@tmesa.com...
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.heyes@gmail.com [mailto:richard.heyes@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


« previous php.general (#294033) next »