IP LAN Ping range with fsockopen


/ Published in: PHP
Save to your folder(s)

http://www.guizzardi.net/


Copy this code and paste it in your HTML
  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. ?>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.