i want to use this script to do ping without using the exec(); or the commands that similar to it.
the problem is i get these errors:
Strict Standards: Non-static method Net_Ping::factory() should not be
called statically in C:\xampp\htdocs\test.php on line
3Strict Standards: Non-static method Net_Ping::_setSystemName() should
not be called statically in C:\xampp\php\PEAR\Net\Ping.php on line 141Strict Standards: Non-static method Net_Ping::_setPingPath() should
not be called statically in C:\xampp\php\PEAR\Net\Ping.php on line 143Strict Standards: Non-static method PEAR::isError() should not be
called statically in C:\xampp\htdocs\test.php on line
4
the code on test.php
<?php
require_once "Net/Ping.php";
$ping = Net_Ping::factory();
if (PEAR::isError($ping)) {
echo $ping->getMessage();
} else {
$ping->setArgs(array('count' => 2));
var_dump($ping->ping('example.com'));
}
?>
Here is a ping class I wrote last year when I needed to do this on a system that didn’t have PEAR.
Example usage: