| $descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open('ruby mixi_voice.rb', $descriptorspec, $pipes);
if (is_resource($process)) {
$str = mb_convert_encoding( $_POST['text1'], "utf-8", "euc-jp" );
$str = urlencode($str);
fwrite($pipes[0],
"user1={$_POST['user1']}&pass1={$_POST['pass1']}&text1=$str");
fclose($pipes[0]);
echo stream_get_contents($pipes[1]);
fclose($pipes[1]);
stream_get_contents($pipes[2]);
fclose($pipes[2]);
$return_value = proc_close($process);
echo "command returned $return_value\n";
}
| |