Re: re:Pinging from php srcipt

From: Date: Wed, 16 Aug 2000 05:04:18 +0000
Subject: Re: re:Pinging from php srcipt
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-11917@lists.php.net to get a copy of this message
Lars Torben Wilson wrote: > Joseph H Blythe writes: > > Lars Torben Wilson wrote: > > > <?php > > > $host = 'www.thebuttlesschaps.com'; > > > if (!$result = ping -c 3 -q $host) { > > > echo "Unknown host\n"; > > > } else { > > > /* The only slashes that show up ni the output are those right > > > * around the information we want, so split it up on that. */ > > > $result = explode('/', $result); > > > $result = $result[3]; > > > echo "Average ping time: $result\n"; > > > } > > > ?> > > > > Hey this works great, but how do I supress the output from the system command? > > > > Mutch appreciated :-) > > > > Joseph Blythe > > There is no system() command--just use backticks around the ping > command, and all of its output is assigned to $result. (Make sure > they're backticks, and not regular single quotes). For more > information on backticks, check out: > > http://www.php.net/manual/language.operators.execution.php > Hey well you learn something new everyday eh! Well im going home now (I wish). Thanks for both of your help, I love this list. Joseph

« previous php.general (#11917) next »