Re: re:Pinging from php srcipt
| From: | Joseph H Blythe | Date: | Wed, 16 Aug 2000 03:12:11 +0000 |
| Subject: | Re: re:Pinging from php srcipt | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11904@lists.php.net to get a copy of this message | ||
David Robley wrote:
> On 16 Aug, Joseph H Blythe wrote:
> > Hey all,
> >
> > I was just wondering how one would go about sending a ping to a remote
> > host and recieving the response time in a php script.
> How about:
>
> $command = "/path/to/ping -c 3 -q $host";
> $result = system($command, $retval);
>
> Tune ping arguments to suit and the output will be sent to the browser;
> it's also in $result so you can grab that and deal with it as needed.
> Note that you will want the c flag or ping will just keep on pingin'
Cool thanks :-)
I have played around with this after reading the ping man page. Does anyone
know if you can get ping to output only the average and nothing else, or
will I have to write a complex script to parse the output to only grab the
average?
Thanks again,
Joseph Blythe
--
BoldFX / Binary Logic
257 Churchill Road Prospect South Australia 5082
Ph: (08) 8342 0022 Fax: (08) 8342 0155
mailto: joseph.blythe@binarylogic.com.au