Re: Getting the Output from System Commands in WINNT

From: Date: Sat, 04 Nov 2000 19:17:59 +0000
Subject: Re: Getting the Output from System Commands in WINNT
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-3684@lists.php.net to get a copy of this message
Look below... > I've determined that finger is actually being invoked, it shows up as a > process momentarily as the page is loading. It seems that my problem is in > the way I am trying to get the output. Any suggestions? See below for the > approaches I have tried... >> <? >> $finger = "finger someone@somewhere"; >> system($finger); >> ?> Try: $finger = finger someone@somewhere; (those are backticks, not quotes) But... there was a report in this list that using backticks on NT seems to crash PHP. I'm using it succesfully on win98 to do just what you want, but with ping. >> <? >> $finger = "finger someone@somewhere"; >> exec($finger); >> ?> From the manual (under Program Executions-exec): "If the array argument is present, then the specified array will be filled with every line of output from the command." So you have to receive the output in an array, but specifying it inside the parameters of the function, like: exec($finger,$result); And then you have to parse the results in the array $result to get what you want, or just implode("<BR>\n",$result) and echo back the whole string, like (untested): $finger = "finger someone@somewhere"; exec($finger,$result); $showme=implode("<BR>\n",$result); echo $showme; Will that work? Gonzalo.

« previous php.windows (#3684) next »