I'm trying to launch the Linux console application yewtube using php, and then have php interact with it programmatically. The application allows you to search youtube and then select items from the results and play their audio through the command line application. I am able to perform the search functions and play functions fine from php by writing to the stdin pipe generated by proc_open(). These actions are a search string followed by an enter key press "\n" or a search result number followed by an enter key press. Once a song is playing, however the control key presses that I write to the stdin pipe are being ignored. These control key presses don't require an enter key press to function. I've tried sending the characters in alone as well as with a "\n" appended. I've tried calling fflush() after writing to the pipe with no results. Any suggestions are appreciate. I'm trying to build this utility for my own personal use, not for work or any monetary gain. :)
This is how I open the application from php:
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("pipe", "w") // stderr is a pipe that the child will write to
);
$env = null;
$options = array();
$process = proc_open($cmd, $descriptorspec, $pipes, null, $env, $options);
writing the command to the stdin pipe:
fwrite($pipes[0], $input);
fflush($pipes[0]);
This is what the application's UI looks like when I'm trying to send it the control characters to pause " ", or change volume"0" or "9". These controls work just fine when I'm manually running the application on the command line:
