Re: [PHP] re:Pinging from php srcipt From: Joseph H Blythe (joe.blythe <email protected>)
Date: 08/15/00

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 <email protected>

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>