Re: [PHP] re:Pinging from php srcipt From: David Robley (huntsman <email protected>)
Date: 08/15/00

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.
>
>
> Thanks,
>
>
> Joseph
>
> --
> BoldFX / Binary Logic
> 257 Churchill Road Prospect South Australia 5082
> Ph: (08) 8342 0022 Fax: (08) 8342 0155
> mailto: joseph.blythe <email protected>

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'

Cheers

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA

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