How in PHP to translate such a construction into a Curl query?
curl -X POST \ -H "Authorization: Bearer ${IAM_TOKEN}" \ -H "Transfer-Encoding: chunked" \ -o speech.raw \ --data-urlencode "text=Привет мир" \ -d "voice=zahar&emotion=good&folderId=${FOLDER_ID}&format=lpcm&sampleRateHertz=48000" \ https://pi.cloud.net/speech/tts:synthesize > speech.ogg I can not figure out how to specify - data-urlencode
I did it like this:
$folder_id = '23232312ASdgf43'; $url_tts = 'https://pi.cloud.net/speech/tts:synthesize'; $data_tts = "voice=zahar&emotion=good&format=lpcm&sampleRateHertz=48000&folderId=$folder_id"; $authorization_cloud = "Authorization: Bearer ".$iam_token; $headers[] = $authorization_cloud; $headers[] = 'Transfer-Encoding: chunked'; $ch = curl_init($url_tts); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_tts); $result = curl_exec($ch); curl_close($ch);