Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

cookies are not being stored into the specified txt file on a php curl script

$
0
0

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);





?>

Viewing all articles
Browse latest Browse all 13200

Trending Articles