cookies

Summary

Specifies whether or not cookies are used in a request or what cookie jar 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.

  1. $jar = new \GuzzleHttp\Cookie\CookieJar();
  2. $client->request('GET', '/get', ['cookies' => $jar]);

Warning

This option only has an effect if your handler has the GuzzleHttp\Middleware::cookies middleware. This middleware is added by default when a client is created with no handler, and is added by default 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.