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 protected]&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); ?> Link to comment https://forums.phpfreaks.com/topic/280345-cookies-are-not-being-stored-into-the-specified-txt-file-on-a-php-curl-script/ 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 Link to comment https://forums.phpfreaks.com/topic/280345-cookies-are-not-being-stored-into-the-specified-txt-file-on-a-php-curl-script/#findComment-1441497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.