Net_Ping::ping()

Net_Ping::ping() – executes a ping command

Synopsis

require_once 'Net/Ping.php';

string Net_Ping::ping ( string host )

Description

Executes a ping command

Parameter

  • string $host - the name of the server or the IP-adress

Return value

string - the return message of the ping command

Note

This function can not be called statically.

Example

Sending a ping request

<?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'));
}
?>
constructor (Previous) set arguments for a ping command (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.