laravelguzzlehttpcookielaravel-http-client

How to send cookie with Laravel Http client?


I am trying to set cookies using the Laravel HTTP client. I know Laravel uses guzzlehttp/guzzle library in the backend.

This is the error I am getting when I try to set the cookies using withOptions method. enter image description here

Have anyone figured it out?


Solution

  • I utilized withCookies to include cookies with the request, although it's worth noting that this method isn't explicitly documented in the Laravel official documentation.

    Http::withCookies([
        '.ASPXAUTH' => $this->authCookie,
    ]