stream
- Summary
- Set to
true
to stream a response rather than download it allup-front. - Types
- bool
- Default
false
- Constant
GuzzleHttp\RequestOptions::STREAM
- $response = $client->request('GET', '/stream/20', ['stream' => true]);
- // Read bytes off of the stream until the end of the stream is reached
- $body = $response->getBody();
- while (!$body->eof()) {
- echo $body->read(1024);
- }
Note
Streaming response support must be implemented by the HTTP handler used bya client. This option might not be supported by every HTTP handler, but theinterface of the response object remains the same regardless of whether ornot it is supported by the handler.