0

I am having a problem with capturing text when I make an exec call to a perl script that just prints a lot of text. What happens when I run the following code is I get a 1 word result: "Array". I need to be able to capture the results so that I can change them around just a little bit. Here is the code:

<?php 
    $lastline = exec("perl parseOutput.pl",$retVal);
    echo $retVal;
?>

How do I work around this?

2 Answers2

0

You have an array of the lines of text that was outputted.

Do something like this:

echo implode( "\n", $retVal);

Or

echo implode( "<br />\n", $retVal);

And you'll see all of the output generated by the perl script.

nickb
  • 59,313
  • 13
  • 108
  • 143
0

just use shell_exec()

$fullResult = shell_exec("perl parseOutput.pl");
echo $fullResult;
goat
  • 31,486
  • 7
  • 73
  • 96