Re: system() and stdout

From: Date: Sun, 04 Mar 2001 18:13:29 +0000
Subject: Re: system() and stdout
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42513@lists.php.net to get a copy of this message
You have to have the output as part of the system or exec command, Here's a ping function, maybe this will help: exec("/bin/ping -c3 $ipaddr", $output, $error); echo "<BR>\n"; while (list(,$line) = each($output)){ echo $line, "<BR>\n"; } if ($error){ die("OS Error: $error. Try using man ping, this also usually boils down to path/permissions."); } ----- Original Message ----- From: "Michael Robbins" <mdrobbins@home.com> To: <php-general@lists.php.net> Sent: Sunday, March 04, 2001 11:53 AM Subject: [PHP] system() and stdout > I am trying to use system() to run an external command and have the output > placed into a variable using: > > $output = system("/usr/local/bin/somecommand"); > > the output is placed into $output, and it also places it instream with the > HTML. Anyone know why this is happening? or how to properly put data from > STDOUT into a variable? > > Any help is appreciated. > > Mike Robbins > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#42513) next »