Re: PHP: how to ping a server ?
| From: | Philip Olson | Date: | Tue, 19 Dec 2000 17:21:27 +0000 |
| Subject: | Re: PHP: how to ping a server ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31036@lists.php.net to get a copy of this message | ||
hmm, how about :
function pingHost($host,$num=3)
{
exec("ping -c $num $host",$results);
foreach($results as $result) {
$tmp .= "$result<br>";
}
Return $tmp;
}
$num is 'Count' (number of pings). For options, in *nix type "man ping".
Use: print pingHost('www.php.net',5);
Regards,
Philip
--.sig
[ Want to write Good code? First, write Bad code. ]
[ Will work for money : http://www.cornado.com ]
On Tue, 19 Dec 2000, Paul wrote:
> Hello,
>
> I'm looking for 3 day's for a PHP code that's pings a server. And i got not yet
> a succesful code, so maby the The Master's can help.
> I want the result's something like thise "www.php.net Ping : 200"
>
> I hope that The Master's can help me ;)
> Greets fron Paul
>