All pastes #12289 Raw Edit

Something

public text v1 · immutable
#12289 ·published 2005-05-20 20:39 UTC
rendered paste body
Client: yourscript.php

<?php
$descriptorspec = array(
   0 => array("pipe", "r"),
   1 => array("pipe", "w"),
   2 => array("pipe", "w"),
   3 => array("pipe", "r")
);

$process = proc_open('myscript.php', $descriptorspec, $pipes);

if(is_resource($process)) {

   fwrite($pipes[0], 'This is stdin');
   fwrite($pipes[3], 'This is the audio stream');

   fclose($pipes[0]);
   fclose($pipes[1]);
   fclose($pipes[2]);
   fclose($pipes[3]);

   $return_value = proc_close($process);
}
?>


Server: myscript.php
#!/usr/local/bin/php -q
<?php
  $stdin = fopen("php://stdin", 'r');
  $audo = fopen(????, 'r');

  echo fgets($stdion, 4096) . "\n";
  echo fgets($audio, 4096) . "\n";

  fclose($stdin);
  fclose($audio);
?>
?>