Php Curl Login Cookie return error that no cookie -
i have site try login, cookies set , saved file, after send postfiend login page, website redirect me page warring me cookies not enabled.
$post = "username=".$user."&password=".$pswd."&loginbutton=1"; $options = array( curlopt_useragent => 'mozilla/4.0 (compatible; msie 6.0; windows nt 5.0)', curlopt_post => true, //using post curlopt_url => $address, //where go curlopt_postfields => $post, //input params curlopt_returntransfer => true, //returns string value of request curlopt_ssl_verifypeer => false, //avoid ssl problems curlopt_header => 1, curlopt_failonerror => true, //curlopt_followlocation => true, curlopt_cookiejar => 'cookies.txt', curlopt_cookiefile => 'cookie.txt', //save cookies curlopt_cookiesession => true, ); //cookies located $ch = curl_init(); //initialize curl in $ch curl_setopt_array($ch, $options); //add params values $ch $content = curl_exec($ch); //execute echo $content;
usually happens because site sets required cookies on previous page, perhaps page shows login form.
one way detect flush browser cookies , navigate web site browser , investigate when cookies sent server first time.