PEAR’s Net_Ping is a niffty wrapper class for executing ping calls from PHP. You can use it to check if a remote server is responding correctly. The library can be download from here.
Net_Ping being a Pear package we will use the Pear installer to download and install it. I recommend to always use the Pear installer to download packages rather than downloading it manually as the Pear installer automatically downloads any dependent packages.
A example of using Net_Ping is given below.
The output of the same is shown below.
I have found your post about pinging in php with the pear net_ping class.
Could you please tell me how I can use the output data? I have no clue how to use the data so I echo for example the IP adres on a page.
can any one help me out how to print down the value of the array..?
A easy way is to run the code from the command line and redirect the output to a text file, which you can print as shown below. Assuming your code filename is Ping.php.
this is great stuff, thank you. i had to mess with this a little more than I wanted but finally got it.