ShakilAhmed Posted July 20, 2013 Share Posted July 20, 2013 this login script takes me to the logged in home page. but it's unable to browse any other pages since the cookie.txt file remains empty. why this script aint storing cookies ? i checked file permission of the cookie.txt file and found it as writable to scripts. here is the codes <?php $ckfile="/tmp/cookie.txt"; $url="https://m.facebook.com/login.php?refsrc=https%3A%2F%2Fm.facebook.com%2F&refid=8"; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Accepts all CAs curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 2); curl_setopt($ch, CURLOPT_USERAGENT, "Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.15066/886; U; en) Presto/2.4.15"); curl_setopt($ch, CURLOPT_POSTFIELDS, "email=myemail@gmail.com&pass=mypassword111"); curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile); curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile); //Uses cookies from the temp file curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Tells cURL to follow redirects $output = curl_exec($ch); echo $output; curl_close($ch); ?> Quote Link to comment Share on other sites More sharing options...
.josh Posted July 20, 2013 Share Posted July 20, 2013 try setting CURL_COOKIESESSION to true also make sure the directory where the file is is chmod 777 too Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.