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?
PHPJavaScriptWeb Development

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ziceva

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ray Paseur

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

Your help has saved me hundreds of hours of internet surfing.
fblack61