Link to home
Start Free TrialLog in
Avatar of pillmill
pillmill

asked on

Capture multiple lines of output?

A program executing in windows, produces multiple lines of ouput.

This program just outputs the last line:

<?php
     $str= "prog.exe";
     $output=exec($str);
?>

How can I get all of the lines of output in my variable?
ASKER CERTIFIED SOLUTION
Avatar of ziceva
ziceva
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not sure, because I have never used exec() but something like this might be worth trying.
<?php 
error_reporting(E_ALL);
ob_start();
exec('prog.exe');
$out = ob_get_clean();
var_dump($out);

Open in new window