Jump to content

does php have interval/timeout capabilities


dsdsdsdsd

Recommended Posts

 

hello;

 

javascript and actionscript both have set_interval type of functions, such as:

var my_interval = setTimeout( a_function , number_of_milliseconds , my_argument_list )

 

 

does php have something similar;

 

I have come across 'curl' functions, though I am not certain if my php ( and my webhost's ) has the curl extension, so I am hoping that php has something more naturally inherent;

 

thanks

dsdsdsdsd

hello rhodesa and cooldude832;

 

this question is in conjunction with another question regarding the question: 'can php ping client-side apps';

 

by the way, 'timeout' is a mis-nomer ( javascript uses the term );

 

really a time-based interval is what I am interested in, so that I can perform a function ( ie, a ping function ) every 85 milliseconds;

 

thanks

dsdsdsdsd

 

 

UPDATE: Ignore this...I missed the "client side app" portion...

 

right, but you could do something like:

 

<?php
  $host = "www.hostname.com";
  while(1){
    passthru("ping -n 1 $host");
    usleep(85000);
  }
?>

 

When run, it will continually ping/wait 85 milliseconds until you cancel the script

UPDATE: Ignore this...I missed the "client side app" portion...

 

right, but you could do something like:

 

<?php
  $host = "www.hostname.com";
  while(1){
    passthru("ping -n 1 $host");
    usleep(85000);
  }
?>

 

 

Your host company will probably shut u done for that, not to mention you can get cron to run every 30 minutes or faster if need be

 

When run, it will continually ping/wait 85 milliseconds until you cancel the script

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.