sink
Summary
Specify where the body of a response will be saved.
Types
- string (path to file on disk)
fopen()resourcePsr\Http\Message\StreamInterface
Default
PHP temp stream
Constant
GuzzleHttp\RequestOptions::SINK
Pass a string to specify the path to a file that will store the contents of the response body:
1. $client->request('GET', '/stream/20', ['sink' => '/path/to/file']);
Pass a resource returned from fopen() to write the response to a PHP stream:
1. $resource = fopen('/path/to/file', 'w');
2. $client->request('GET', '/stream/20', ['sink' => $resource]);
Pass a Psr\Http\Message\StreamInterface object to stream the response body to an open PSR-7 stream.
1. $resource = fopen('/path/to/file', 'w');
2. $stream = GuzzleHttp\Psr7\stream_for($resource);
3. $client->request('GET', '/stream/20', ['save_to' => $stream]);
Note
The save_to request option has been deprecated in favor of the sink request option. Providing the save_to option is now an alias of sink.
