title: Amazon Polly Implementation Using PHP SDK
body: <p>I am trying to integrate the Amazon Polly web service into one of my projects using Amazon's PHP SDK. But when I used the PollyClient SDK, there is only one method implemented in the client <code>createSynthesizeSpeechPreSignedUrl()</code> and it returns a url, not the audio clip. When I try and paste the url in the browser window I get the following error: <code>"message": "The security token included in the request is invalid."</code></p>
  
  <p>Please see my code snippet:</p>
  
  <pre class="lang-php prettyprint-override"><code>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'      =&gt; 'us-west-2',
              'version'     =&gt; 'latest',
              'debug'       =&gt; true,
              'scheme'      =&gt; 'http',
              'credentials' =&gt; [
                  'key'    =&gt; 'XXXXX',
                  'secret' =&gt; 'XXXXXX',
              ],
          ];
          $client     = new PollyClient($connection);
          $polly_args = [
              'OutputFormat' =&gt; 'mp3',
              'Text'         =&gt; 'My Input text',
              'TextType'     =&gt; 'text',
              'VoiceId'      =&gt; 'Brain',
          ];
          $result     = $client-&gt;synthesizeSpeech($polly_args);
  
          echo '&lt;pre&gt;';
          print_r($result);
          exit;
      }
  }
  </code></pre>
  
  <p>The PHP error I am getting is:</p>
  
  <pre><code>Fatal error Uncaught exception 'Aws\Polly\Exception\PollyException' with message 'Error executing &amp;quot;SynthesizeSpeech on http://polly.us-west-2.amazonaws.com/v1/speech
  
   AWS HTTP error: cURL error 7: Failed to connect to polly.us-west-2.amazonaws.com port 80: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'
  
  exception 'GuzzleHttp\Exception\ConnectException' with message 'cURL error 7: Failed to connect to polly.us-west-2.amazonaws.com port 80: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in D:\xampp\htdocs\sim_aws\aws\GuzzleHttp\Handler\CurlFactory.php:186
  Stack trace:
  </code></pre>
  
  <p>The interesting part is, I was able to generate the audio clip using Node.js SDK, so I'm quite sure that the access key and secret key is working fine.</p>
  
  <p>It would be great if anyone can point out how the PHP SDK can be used with sample code or useful links.</p>