On Sun, 2003-06-22 at 20:19, Daevid Vincent wrote: [snip]
> http://us3.php.net/manual/en/function.exec.php > string exec ( string command [, array output [, int return_var]]) > exec() executes the given command, however it does not output anything. It > simply returns the last line from the result of the command. > > However, you are correct in that there is the optional parameter that I've > never used before. Thanks for pointing that out... > > http://us3.php.net/manual/en/function.system.php > string system ( string command [, int return_var]) > system() is just like the C version of the function in that it executes the > given command and outputs the result. If a variable is provided as the > second argument, then the return status code of the executed command will be > written to this variable. > > The problem is that system want's to dump the output to the screen!!! I need > a command that will allow me to execute/system the command "silently" and > then *I* can do something based upon the exit code... No offense, but why not just use exec() and its third argument, as suggested and as you yourself noted? It does, in fact, do what you are asking for. You are quite correct that system() is not the function you want. Just wondering. :) Torben > function active_nMap() > { > $test = exec("/usr/bin/nmap -sP ".$this->IP); > if ( strstr($test,"1 host up") ) > $this->active = true; > else > $this->active = false; > > return $this->active; > } > > function active_ping() > { > $test = `ping -n -c 1 -w 1 -q $this->IP`; > if ( strstr($test,"100% loss") ) > $this->active = false; > else > $this->active = true; > > return $this->active; > } > > > function active_ping_exit() > { > //http://us3.php.net/manual/en/function.system.php > $test = system("ping -n -c 1 -w 1 -q $this->IP", $code); > if ( $code == 0 ) > $this->active = true; > else > $this->active = false; > > return $this->active; > } > > -- Torben Wilson <[EMAIL PROTECTED]> +1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com -----==== Boycott Starbucks! http://www.haidabuckscafe.com ====----- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php