Solved

Capture multiple lines of output?

Posted on 2012-03-12
2
218 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 108

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
wordpress issue 2 24
Angular - where do I need to put this code? 3 13
Post xml via PHP Soap Client 3 15
WIX Redirect 1 7
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now