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 aGuzzleHttp\Cookie\CookieJarInterface or false.

  1. $jar = new \GuzzleHttp\Cookie\CookieJar();
  2. $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 trueto use a shared cookie session associated with the client.