php - cURL cookiejar line commented out with #HttpOnly_? -
i'm trying login punbb forum different page on same domain using curl.
when logging in, curl gets executed , initial response 'successful login' page of forum. no cookie got set when clicking link in forum, , i'm logged out.
after bit of investigating cookiejar file mentions cookie needed login. if create cookie , value manually inb browser, logged in , well. cookie value stored correct.
the line containing cookie name/value in cookiejar commented out.
first question: why? second: how prevent behavior?
here's cookiejar:
# netscape http cookie file # http://curl.haxx.se/rfc/cookie_spec.html # file generated libcurl! edit @ own risk. www.example.com false / false 0 phpsessid 3d7oe6vt3blv3vs3ea94nljcs7 #httponly_www.example.com false / false 1340974408 forum_cookie_e19209 mnwyywq4ogvindi2nje5mwewmgzingzkndfmzdy5zdzhyjm5ota5ndvjfdeznda5nzq0mdh8otu0ntexogzhnwnlngy5ogmzzdk3mme0ndlmmwrjnzm3zji1nzmxoa%3d%3d
and here's curl call:
function forumlogin() { $loginfields = array('req_username' => $_request['username'] ,'req_password' => $_request['password'] ,'form_sent' => "1" ); //and on $login = geturl('http://www.example.com/manager/forum/login.php', 'post', $loginfields); return $login; } function geturl($url, $method='', $vars='') { $ch = curl_init(); if ($method == 'post') { curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $vars); } curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 0); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_cookiejar, 'cookies.txt'); curl_setopt($ch, curlopt_cookiefile, 'cookies.txt'); $buffer = curl_exec($ch); curl_close($ch); return $buffer; } // successful login reset fail count , update key values if(isset($_session['mgrvalidated'])) { $sql = "update $dbase.`".$table_prefix."user_attributes` set failedlogincount=0, logincount=logincount+1, lastlogin=thislogin, thislogin=".time().", sessionid='$currentsessionid' internalkey=$internalkey"; $rs = mysql_query($sql); var_dump( forumlogin() ); } exit;
the #httponly_ prefix on line not comment. magic string tell browser/client cookie in question httponly one. curl understand , deal accordingly.
i don't understand part clicking on things don't see how related or relevant curl-using program.
Comments
Post a Comment