Solved

Capture multiple lines of output?

Posted on 2012-03-12
2
222 Views
Last Modified: 2012-03-19
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?
0
Comment
Question by:pillmill
2 Comments
 
LVL 7

Accepted Solution

by:
ziceva earned 500 total points
ID: 37711109
Try this:

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

More info here:
http://www.php.net/manual/en/function.exec.php
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37712093
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

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question