Answer the question
In order to leave comments, you need to log in
How to recognize audio to text by google in php?
I try the demo code from the main page https://cloud.google.com/speech-to-text/ like this:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://speech.googleapis.com/v1/speech:recognize?key=myKey');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"audio":{"content":"RTovT1NQYW5lbC9kb21haW5zL3Rlc2R0L3ZpZGVvcy9nZGdkcy5mbGFj"},"config":{"enableAutomaticPunctuation":true,"encoding":"FLAC","sampleRateHertz":16000,"languageCode":"ru-RU","model":"default"}}');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$out = curl_exec($ch);
curl_close($ch);
echo $out;
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question