Tuesday, 20 August 2013

Php form to run Google Text to Speech script on server

Php form to run Google Text to Speech script on server

so I want to run this via php exec.
./text2speech.sh "My name is Oscar and I am testing the audio."
Below is my code, how can I send the "" without interfering with the php?
<?php
function doSomething($command) {
exec("./text2speech.sh". " $command", $output);
echo "Returned output:";
var_dump($output);
}
if(count($_POST) > 0 && isset($_POST['command'])) \
{
doSomething($_POST['command']);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Terminal Emulator</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input autocomplete="off" id="command" name="command"
type="text">
<input type="submit" value="Submit">
</form>
</body>
</html>

No comments:

Post a Comment