Re: Using Exec Function
| From: | Jason Barnett | Date: | Thu, 16 Jun 2005 14:52:12 +0000 |
| Subject: | Re: Using Exec Function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-217071@lists.php.net to get a copy of this message | ||
Exec is the way to go... it gives you output as well as any error status. Here's an example script that works for a Win32 program I have and you should be able to adapt to your own usage:
<?php
/** Notice that the command has extra quotes around it for the Windows command line as well as double-backslashes for each directory in the path */
$win_cmd = "\"C:\\Program Files\\The Regex Coach\\The Regex Coach.exe\"";
exec($win_cmd, $stdout, $stderr);
print "Standard output:\n";
print_r($stdout);
print "Standard error:\n";
print_r($stderr);
?>
--
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php