我正在尝试使用Amazon的PHP SDK将Amazon Polly Web服务集成到我的一个项目中。但是,当我使用PollyClient SDK时,客户端中仅实现一种方法createSynthesizeSpeechPreSignedUrl(),它返回url,而不返回音频剪辑。当我尝试将URL粘贴到浏览器窗口中时,出现以下错误:"message": "The security token included in the request is invalid."
请查看我的代码段:
error_reporting(E_ALL);
ini_set('display_errors', 1);
header('Content-Type: text/plain; charset=utf-8');
require_once 'app/aws/aws-autoloader.php';
use Aws\Polly\PollyClient;
class TestPolly extends Base {
public function newPolly () {
$connection = [
'region' => 'us-west-2',
'version' => 'latest',
'debug' => true,
'scheme' => 'http',
'credentials' => [
'key' => 'XXXXX',
'secret' => 'XXXXXX',
],
];
$client = new PollyClient($connection);
$polly_args = [
'OutputFormat' => 'mp3',
'Text' => 'My Input text',
'TextType' …Run Code Online (Sandbox Code Playgroud)