1. Go to this page and download the library: Download ne0bot/ping library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ne0bot / ping example snippets
$host = 'www.example.com';
$ping = new Ping($host);
$latency = $ping->ping();
if ($latency !== -1) {
print 'Latency is ' . $latency . ' ms';
}
else {
print 'Host could not be reached.';
}