[ class tree: PPPing ] [ index: PPPing ] [ all elements ]


Using PPPing - PurplePixie PHP Ping Utility

To use the PPPing utility:

1. Include the ppping.inc.php file
e.g. include "ppping.inc.php"

2. Instantiate a PPPing object
e.g. $ping = new PPPing();

3. Set the hostname parameter with either a resolvable host or an IP address
e.g. $ping->hostname = "www.purplepixie.org";

4. Set any optional flags (see the code documentation for more information
on these)

5. Ping and get a result
e.g. $result = $ping->Ping();

6. Analyse the result. A negative number indicates a failure, a positive number
is the return time in milliseconds (ms). If the ping failed then you can pass
the result to the strError() method to get a textual description of the failure.
$result = $ping->Ping();
if ($ping<0) // failed
 echo "Error: ".$ping->strError($result);
 echo $result." ms";

7. Optionally get more information about the last ping returned through the last
array. This will contain the following elements:
$ping->last['set'] - boolean true/false contains data or not
$ping->last['result'] - result returned from the Ping()
$ping->last['ttl'] - TTL of returned packet
$ping->last['hops'] - Hops based on an initial TTL of 64
$ping->last['source'] - IP address of source of return (remote system)
$ping->last['destination'] - IP of destination for return (local system))

Documentation generated on Sun, 28 Feb 2010 14:06:03 +0000 by phpDocumentor 1.4.3