I try the demo code from the main page https://cloud.google.com/speech-to-text/ in this way:

<?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; ?> 

In return, I get {}

php code for post request stupidly copied

how to get decryption text?

    1 answer 1

    "content": "there should be an ALL AUDIO FILE encoded in base64"