php实现ping

  • A+
所属分类:PHP编程
  1. <?php // created by joe lumbroso 
  2. // see some other good php3 scripts 
  3. // goto http://www.dtheatre.com/scripts echo "<font color=\"red\"><blink><b>Pinging</b></blink></font><br>"; 
  4. $to_ping = "dtheatre.com";
  5. $count = 3;
  6. $psize = 65;
  7. echo " Please be patient, this can take a few moments...\n<br><br>";
  8. flush(); while (1) {
  9. ?>
  10. <pre>
  11. <?
  12. exec("ping -c $count -s $psize $to_ping", $list);
  13. for ($i=0;$i < count($list);$i++) {
  14. print $list[$i]."\n";
  15. }
  16. ?>
  17. </pre>
  18. <?
  19. flush();
  20. sleep(3);
  21. }
  22. ?>