|
Posted by Rik on 06/14/06 16:19
Vincent Delporte wrote:
> Hi
>
> The script I'm writing needs to wait a random amount of time (1-300s)
> between each iteration of a loop, eg.
>
> while(condition) {
> do something
> //wait between 1s and 5 minutes
> sleep(rand(1,300));
> }
>
> Problem is, a browser times out if it doesn't get an answer within
> about 30 seconds. Is the idea of having a PHP script sleep for a
> longer amount of time incompatible with web applications? Any
> work-around?
Feed some bogus information?
for($i=0;$i<=rand(1,60);$i++){
echo ' ';
sleep(5);
}
Not very elegant, but gets the job done I think.
Grtz,
--
Rik Wasmus
[Back to original message]
|