Guzzle Cookies

100 views
Skip to first unread message

Nikita Logachev

unread,
Apr 14, 2014, 9:16:04 AM4/14/14
to guz...@googlegroups.com
Hello,

I need in auth on website by post request.
I dont need auth on site on every request. 
How to save cookie in File and then use them in other requests?

Nikita Logachev

unread,
Apr 14, 2014, 9:22:13 AM4/14/14
to guz...@googlegroups.com
Unknown method, addSubscriber

Nikita Logachev

unread,
Apr 14, 2014, 9:39:06 AM4/14/14
to guz...@googlegroups.com
if set cookies as FileCookieJar:

$cookiePath     = $basePath."/storage/cookie";
        $cookiePlugin   = new FileCookieJar($cookiePath);

        $client = new GuzzleHttp\Client();

        $data = [
            'passwd'    => 'test',
            'login'     => 'test'
        ];

        $res = $client->post('https://test/form', [
            'body'  => $data,
            'cookies' => $cookiePlugin
        ]);

catch exception:

"cookies must be an array, true, or a CookieJarInterface object"

On Monday, April 14, 2014 5:16:04 PM UTC+4, Nikita Logachev wrote:
Reply all
Reply to author
Forward
0 new messages