honey.php 624 B

123456789101112131415161718192021222324252627
  1. <?
  2. /* honey.php - sample fake delay script to push data
  3. - should use ob_flush() to send chunks rather than
  4. just take a long time ...
  5. */
  6. session_start();
  7. $char = " ";
  8. $fakeDelay = (empty($_GET['delay'])) ? 1 : $_GET['delay'];
  9. $dataSize = (empty($_GET['size'])) ? 2*1024 : $_GET['size'];
  10. if (empty($_SESSION['counter'])) $_SESSION['counter'] = 1;
  11. $dataSent = 0;
  12. $blockSize = 1024;
  13. if ($fakeDelay) { sleep($fakeDelay); }
  14. print "view num: ".$_SESSION['counter']++;
  15. while ($dataSent<=$dataSize) {
  16. for ($i=0; $i<$blockSize/4; $i++) {
  17. print $char;
  18. } print "<br />";
  19. $dataSent += $blockSize;
  20. sleep(1);
  21. }
  22. ?>