In linux I want to run a gnome zenity progress bar window from PHP. How zenity works is like this:
linux-shell$ zenity --display 0:1 --progress --text='Backing up' --percentage=0
10
50
100
So the first command opens the zenity progress bar at 0 percent. Zenity then takes standard input numbers as the progress bar percentage (so it will go from 10% to 50% to 100% when you type those numbers in).
I can't figure out how to get PHP to type in those numbers though, I have tried:
exec($cmd);
echo 10;
echo 50;
And:
$handle = popen( $cmd, 'w' );
fwrite( $handle, 10 );
And:
$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
);
$h = proc_open($cmd, $descriptorspec, $pipes);
fwrite($pipes[1], 10);
But none of them updates the progress bar. In what way can I mimic the effect of the stdin on the linux shell to get zenity to update its progress bar?