Posted By

GabrieleGuizzardi on 04/15/12


Tagged

IPLANPingrangefsockopenPHP


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tux-world


IP LAN Ping range with fsockopen


 / Published in: PHP
 

URL: http://www.guizzardi.net/?p=699

http://www.guizzardi.net/

  1. <?php
  2.  
  3. for ($host=1;$host<=255;$host++) {
  4. $hostname = '192.168.1.'.$host;
  5. $port = 80;
  6. $timeout = 3;
  7. $fp = fsockopen ($hostname, $port ,$errno ,$errstr, $timeout);
  8. if($fp) {
  9. echo "Host $hostname RISPONDE.\n";
  10. } else {
  11. echo "Host $hostname non risponde.\n";
  12. }
  13. }
  14. ?>

Report this snippet  

You need to login to post a comment.