cookies
- Summary
- Specifies whether or not cookies are used in a request or what cookiejar to use or what cookies to send.
- Types
GuzzleHttp\Cookie\CookieJarInterface
- Default
- None
- Constant
GuzzleHttp\RequestOptions::COOKIES
You must specify the cookies option as a
GuzzleHttp\Cookie\CookieJarInterface
or false
.
- $jar = new \GuzzleHttp\Cookie\CookieJar();
- $client->request('GET', '/get', ['cookies' => $jar]);
Warning
This option only has an effect if your handler has theGuzzleHttp\Middleware::cookies
middleware. This middleware is addedby default when a client is created with no handler, and is added bydefault when creating a handler with GuzzleHttp\default_handler
.
Tip
When creating a client, you can set the default cookie option to true
to use a shared cookie session associated with the client.