stream

Summary

Set to true to stream a response rather than download it all up-front.

Types

bool

Default

false

Constant

GuzzleHttp\RequestOptions::STREAM

  1. $response = $client->request('GET', '/stream/20', ['stream' => true]);
  2. // Read bytes off of the stream until the end of the stream is reached
  3. $body = $response->getBody();
  4. while (!$body->eof()) {
  5. echo $body->read(1024);
  6. }

Note

Streaming response support must be implemented by the HTTP handler used by a client. This option might not be supported by every HTTP handler, but the interface of the response object remains the same regardless of whether or not it is supported by the handler.