Click to See Complete Forum and Search --> : Control a running program via php (io stream?)


valenok
05-22-2008, 12:11 AM
I'm running a program console program c.exe on the server.
When I have direct access to that computer I just make input to this console with keyboard. ( console like the one you see .. cmd.exe)

I want to make web interface which will send data to this console imitating
keyboard input. What functions should I use ? and how do I get the process id
for the running program.

Much thanks ahead

Phill Pafford
05-22-2008, 09:13 AM
Here is something to start you in the right direction.

http://us.php.net/getmypid

http://us3.php.net/language.operators.execution

http://us3.php.net/features.commandline

http://us3.php.net/shell_exec

valenok
05-22-2008, 10:13 AM
on the computer in Africa I'm running cmd.exe.
I need write in the cmd.exe some text.

All what you gave me is either Starting the cmd.exe ( what I dont need )
or isn't relevant.

nd how do I get the process id for the running cmd.exe.

Phill Pafford
05-22-2008, 11:04 AM
Hi,

Sorry but I think the links I provided are a good start for your question..

To run the cmd.exe and get the PID

http://bugs.php.net/bug.php?id=37316&edit=1

This page has stated that they got it to work.


<?php
$output = shell_exec('/path/to/cmd.exe sometext);
echo "<pre>$output</pre>";
?>

valenok
05-22-2008, 01:19 PM
ok I thought I mentioned that, But I dont see it:
The program(cmd.exe) is already running and I can't restart it every time again

Thanks for this also