x_maras Posted March 28, 2009 Report Share Posted March 28, 2009 Hi! I want to make a page that reads an xml file and presents some data.the xml is exported from a "file.exe" and also takes a parameter "param.wpf". I did it with python using the os module, but I dont know if is it possible to run an exe this way from php and also with the uniform server. If it's possible they both have to be in the server right? If you know something about this, a command or a link or an example would be great , I would be gratefull. Thanks Quote Link to comment Share on other sites More sharing options...
Ric Posted March 28, 2009 Report Share Posted March 28, 2009 The following example may be of help! I am using test.bat replace it with your .exe Save the following test.bat to any folder (it does not need to be in server root) for example c:\test\test.bat It’s a simple batch file that just echos a few lines, @echo offif "%1"=="param.wpf" goto :REVecho 123echo 456echo 789goto :END:REVecho 987echo 654echo 321:ENDexit Save the following test.php to root folder www <?php$output = `c:/test/test.bat param.wpf`;echo "$output"; $output = `c:/test/test.bat`;echo "$output"; $output = `dir *.php`;echo "$output";?> Note: The $output’s are not using quotes but backticks, in other words they are running system commands. The first demonstrates passing a parameter to the batch file (executable). Second just runs the batch file with no parameters. The last one demonstrates running a standard dos command and passing a parameter (if your executable is on a system path there is no need to specify a path) This PHP page may be of use Al the bestRic Quote Link to comment Share on other sites More sharing options...
BananaAcid Posted April 2, 2009 Report Share Posted April 2, 2009 be carefull of using backtick operations. safe mode might be a problem. you should also see into the other exec commands. (but the backtick way IS the easiest) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.