Page 1 of 1

Exec multiple comands

Posted: Mon Jul 26, 2010 11:39 am
by papa_smurf
Hello everyone,

I'm starting to go crazy looking for an answer. Is it possible to execute multiple commands from php using the exec() function?

Here is an example, I have an executable file, driv_calc.exe. When I execute that file, it prompts me with a series of options to choose from. So i'll enter 4 for option 4. Then the program will prompt me with another list and so on and so forth.

Can I perform this same task in php? If so, how? If not, why not?

Thanks

Re: Exec multiple comands

Posted: Mon Jul 26, 2010 11:45 am
by AbraCadaver
Only if the executable can run without user interaction with some command line args, such as: driv_calc.exe 4 2 1 4

You may be able to get this functionality using proc_open() or maybe popen().

Re: Exec multiple comands

Posted: Mon Jul 26, 2010 11:55 am
by papa_smurf
Unfortunately it does require user interaction in its current form. So basically files that are run using the exec function can only run properly if they can operate without user interaction during the process?

Re: Exec multiple comands

Posted: Mon Jul 26, 2010 12:52 pm
by AbraCadaver
papa_smurf wrote:Unfortunately it does require user interaction in its current form. So basically files that are run using the exec function can only run properly if they can operate without user interaction during the process?
Yes, so check out proc_open() though it is quite a chore especially if you're not familiar with the process. I would search for a proc_open() tutorial and/or look at the comments on the manual page.