title: AWS SDK for PHP's S3 stream wrapper works for writing, but not for reading
body: <p>I decided to use the AWS SDK's wrapper so I could stream data from my S3 bucket for convenience, but the situation is as follows:</p>
  
  <p>Writing to my bucket with this code works</p>
  
  <pre><code>$client = \Aws\Common\Aws::factory(array(
      'key' =&gt; 'my key',
      'secret' =&gt; 'my secret',))
  -&gt;get('S3');
  
  $client-&gt;registerStreamWrapper();
  
  $fh = fopen('s3://mybucket/test.txt','w');
  fwrite($fh, 'Test');
  fclose($fh);
  </code></pre>
  
  <p>The file exists after this operation, so it's all OK, but I can't read it afterwards since <code>fopen('s3://mybucket/test.txt', 'r')</code> fails with the following warning:</p>
  
  <pre><code>Warning: fopen(s3://mybucket/test.txt): failed to open stream: "Aws\S3\StreamWrapper::stream_open" call failed
  </code></pre>
  
  <p>... And this error:</p>
  
  <pre><code>Fatal error: Uncaught exception 'Guzzle\Common\Exception\RuntimeException' with message 'Error creating resource. [type] 2 [message] fopen(https://mybucket.s3.amazonaws.com/test.txt): failed to open stream: Invalid argument [file] phar://path/to/aws.phar/Guzzle/Stream/PhpStreamRequestFactory.php [line] 217' in phar://path/to/aws.phar/Guzzle/Stream/PhpStreamRequestFactory.php on line 271
  </code></pre>
  
  <p>So, I could catch that exception or use <code>getObject</code> instead but I still wouldn't be able to read the file stream, which defeats the purpose. Perhaps it's not a huge matter, but I'm not familiar with the inner workings of Guzzle and the AWS SDK.</p>
  
  <p>Any help or guides on what I'm doing wrong here will be greatly appreciated, I googled the issue for a while, but I couldn't find useful information to solve it, so it's likely that this is all happening due to my sheer incompetence.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Cheers.</p>