SIGN IN SIGN UP

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.

0 0 0 Java
<?php
2019-01-02 21:21:22 -08:00
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
2019-01-04 14:55:07 -08:00
// snippet-start:[polly.php.put_lexicon.complete]
// snippet-start:[polly.php.put_lexicon.import]
require 'vendor/autoload.php';
use Aws\Exception\AwsException;
2019-01-04 14:55:07 -08:00
// snippet-end:[polly.php.put_lexicon.import]
/**
* This code expects that you have AWS credentials set up per:
* https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html
*/
2019-01-17 14:27:30 -08:00
// snippet-start:[polly.php.put_lexicon.main]
2019-01-04 14:55:07 -08:00
// Create a PollyClient
$client = new Aws\Polly\PollyClient([
2018-12-17 08:55:01 -08:00
'profile' => 'default',
'version' => '2016-06-10',
2018-12-17 08:55:01 -08:00
'region' => 'us-east-2'
]);
$name = 'lexiconName';
$PLS = '
2018-12-17 08:55:01 -08:00
<lexicon version="1.0"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon
http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd"
alphabet="ipa"
xml:lang="en-US">
<lexeme>
<grapheme>W3C</grapheme>
<alias>World Wide Web Consortium</alias>
</lexeme>
</lexicon>';
try {
$result = $client->putLexicon([
'Name' => $name,
'Content' => $PLS,
]);
var_dump($result);
2018-12-17 08:55:01 -08:00
} catch (AwsException $e) {
// output error message if fails
echo $e->getMessage();
echo "\n";
2019-01-04 14:55:07 -08:00
}
2019-01-04 14:55:07 -08:00
// snippet-end:[polly.php.put_lexicon.main]
// snippet-end:[polly.php.put_lexicon.complete]