On Fri, Dec 13, 2002 at 10:02:54AM -0000, Brian McGarvie wrote:
> I can exec ping OK... but I need a way to ping and basically give me a OK or
> Not OK... any ideas?

This isn't really a PHP question, since ping is a command in the OS and
not in PHP itself.  And of course, you didn't mention what OS you run.

I run FreeBSD.  In FreeBSD, ping has options that could be used thusly:

        exec("/sbin/ping -c 1 -t 3 $target", $junk, $ret);
        if ($ret==0)    // In shell, 0 means success
                print "Wahoo!  I can see $ipaddr!\n";
                print "Bummer...  $ipaddr seems to be down.\n";

The option -c specifies a "count" (the number of pings to send), and -t
specifies a timeout in seconds.  If your operating system is UNIX or
Linux, you can "man ping" from a shell to see what you need to do to
duplicate this functionality, or check out various OS man pages at
http://www.freebsd.org/docs.html#man .  If you're running a Microsoft
operating system, you're most likely out of luck.

  Paul Chvostek                                             <[EMAIL PROTECTED]>
  Operations / Abuse / Whatever                          +1 416 598-0000
  it.canada - hosting and development                  http://www.it.ca/

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to