title: How to Stream a Guzzle Response to the browser?
body: <p>I am loading video via a 3rd party API.<br>
  It returns the binary in the body, with the <code>Transfer-Encoding :chunked</code> header.  </p>
  
  <p>I'm using <code>Guzzle 4</code> to consume the api, how can I easily stream this to the browser so I don't need to load the whole thing up into memory in PHP first?</p>
  
  <p>I don't want to set it as an <code>attachment</code>, as I want it to play in the browser rather than download.</p>
  
  <pre><code>&lt;?php
  
  $client = new GuzzleHttp\Client();
  
  // Download the video and stream it to the client
  $response = $client-&gt;get($url)-&gt;send();
  
  //But this will have to cache the whole thing in PHP memory first...
  header("Content-Type:{$response-&gt;getHeader('Content-Type')}");
  echo $response-&gt;getBody();
  </code></pre>