Hi, Im running PHP 5.1.6. What would be the best way to code a script to do the following..

I need to get the current time in seconds/milliseconds and have a loop that sends 16 request at the very begining of that second and then sleep for the remainder of that second before starting again for the next second.

So ie it kicks off at 0 and finishes at say 200ms and then sleeps for the remaining 800ms then starts again at 0.

Thanks for your help.

    Something like this?

    // Say you want to send 8 groups of 16 requests each.
    $loops = 8; 
    $subloops = 16;
    for ($i = 0; $i < $loops; $i++) {
        $start = microtime(true);
        for ($n = 0; $n < $subloops; $n++) {
            echo $n . ' - ' . $i . '<br />';  // Send your requests here.
        }
        while ((microtime(true) - $start) < 1) {}
    }
      Write a Reply...