Re: re:Pinging from php srcipt
| From: | David Robley | Date: | Wed, 16 Aug 2000 02:38:58 +0000 |
| Subject: | Re: re:Pinging from php srcipt | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11901@lists.php.net to get a copy of this message | ||
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@binarylogic.com.au
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