0
I’m trying to work out a php algorithm to get a particular file. flac and , through google Speech return the text generated through the same.
Follow the code below:
$filename="good-morning-google";
$file_to_upload = array('myfile'=>'@'.$filename.'.flac');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/speech-api/v2/recognize?output=json&lang=pt-BR&key=MINHAKEY");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: audio/x-flac; rate=44100"));
curl_setopt($ch, CURLOPT_POSTFIELDS, $file_to_upload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec ($ch);
var_dump($result);
I do not know what is wrong that the return of var $result is equal to false.
the file frame rate "good-Morning-google.flac" is actually at 44100 Hz as specified in its code ?
– ederwander
I am running the test according to this project on github https://github.com/rogerthomas84/php-speech-to-text ... However this giving the same error.
– Doug