PHP code example of delz / xfyun
1. Go to this page and download the library: Download delz/xfyun library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
delz / xfyun example snippets
try {
$content = $client->createTTS()->setText('您好')->send();
$file = fopen(__DIR__ . '/test.wav',"w");
fwrite($file, $content);
fclose($file);
} catch(ApiException $e) {
echo $e->getMessage();
}
try {
$content = $client->createIAT()->setAudio(file_get_contents(__DIR__.'/test.wav'))->send();
echo $content;
} catch(ApiException $e) {
echo $e->getMessage();
}