PHP cURL Class - Cookies not functioning -


i'm using php-curl-class github.

i've sent few posts login website using $curl->post("webiste.com", array()); , after returning data response can verify login successfully.

my issue lies when using $curl->get("http://website.com");.

the php curl class's get() function not reading cookies correctly.

my code contains following @ top of document:

$curl = new curl(); $curl->setcookiefile('cookies.txt'); $curl->setcookiejar('cookies.txt'); 

is not enough get() function use cookies?

i can verify cookies.txt file created , cookies printed in file they're not being used 100%.

i know they're not being read correctly because when use following code:

echo $curl->get("website.com"); 

i can see not logged in.

i've solved problem.

so added

$curl->setcookiefile('cookies.txt'); $curl->setcookiejar('cookies.txt'); 

inside of function, , attempting use

$curl->get(); 

outside of function. , set cookiejar , cookiefile inside function, before $curl->get(); function, needed redeclare cookiefile & jar.


Comments