note 33280 deleted from function.popen by irchtml
| From: | irchtml@php.net | Date: | Mon, 23 Feb 2004 08:25:36 +0000 |
| Subject: | note 33280 deleted from function.popen by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65571@lists.php.net to get a copy of this message | ||
Note Submitter: spamfromnews@freax.org
----
This one works
However, I don't know how secure it is
function filterThroughCmd($input, $commandLine) {
// replace all doublequotes
$input = str_replace ("\"", "\\\"", $input);
$pipe = popen("echo \"$input\"|$commandLine" , 'r');
if (!$pipe) {
print "pipe failed.";
return "";
}
$output = '';
while(!feof($pipe)) {
$output .= fread($pipe, 1024);
}
pclose($pipe);
return $output;
}