Guzzle cookies handling

veliniporter

New Member
I'm building a client app based on Guzzle. I'm getting stucked with cookie handling. I'm trying to implement it using Cookie plugin but I cannot get it to work. My client application is standard web application and it looks like it's working as long as I'm using the same guzzle object, but across requests it doesn't send the right cookies. I'm using \[code\]FileCookieJar\[/code\] for storing cookies. How can I keep cookies across multiple guzzle objects?\[code\]// first request with login works fine$cookiePlugin = new CookiePlugin(new FileCookieJar('/tmp/cookie-file'));$client->addSubscriber($cookiePlugin);$client->post('/login');$client->get('/test/123.php?a=b');// second request where I expect it working, but it's not...$cookiePlugin = new CookiePlugin(new FileCookieJar('/tmp/cookie-file'));$client->addSubscriber($cookiePlugin);$client->get('/another-test/456');\[/code\]
 
Top