Re: Automated Script
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Automated Script

From: Andrew @ Rockface <@>
Date: Tue Oct 04 2005 - 09:50:59 CEST

chotiwallah wrote:
> not possible using php only.
>
> three possible ways around:
>
> 1. use some web based cron (can't remember an url at the moment, sorry)
>
> 2. if you have a local pc that's online 24h, have a little program
> there calling the automated script every x seconds
>
> 3. use the most frequented page of your website to call the automated
> script (using a blind image, for instance). you'd have to include a
> timer in the automated script than.

You could use an infinite loop and stick the code to be executed inside
with a sleep at the end.

$x = 5;
while(1) {
  echo "Hello world";
  sleep($x);
}

Or if you want to re-execute the code a set number of times use:

$x = 5;
$y = 10;
for ($c = 0; $c < $y; $c++) {
  echo "Hello world";
  sleep(5);
}

-- 
Andrew @ Rockface
np: Sylvie - Smoke and Mirrors [stopped]
www.rockface-records.co.uk
Received on Tue Oct 18 02:31:24 2005