Search

Thursday, November 17, 2011

PHP CODE PING IP or HOST

Using following code you can ping host name/ IP Address.  To execute following code you need to change the security permission of cmd.exe
Go to \Windows\System32\cmd.exe right click on it and select properties. Select user Internet Guest Accounts/IUSER….
Then add the full control. Follow the picture.

<body>
<?php
   $host   = "www.yahoo.com";
   echo("Ping Output:<br>");
     
      echo '<pre>';          
     
        system("ping -n 3 $host");
      echo '</pre>';
?>
</body>

Note: you can ping IP address/hostname using this script.

No comments: