The code looks ok, if you insert incorrect login infos appears "incorrect", but if you insert the correct infos, the cURL returns the login page, rather than the homepage (with friends and mural).
Why this happens, what is missing?
Code:
$login_email = 'YOUR MAIL';
$login_pass = 'YOUR PASS';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.facebook.com/login.php');
curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($login_email).'&pass='.urlencode($login_pass).'&login=Login');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIE, "fr=0DlGgNm7j7OSrxwX6.AWW7LPYiS5UCE2Hd72fGrJQiQLs.BVmtC5.sI.FX7.0.AWX65Dnb; lu=SAj6vCvJVQ5w62Kbyx2DPvEw; datr=n9CaVRge8gdmQM4fbYPCgerZ; locale=pt_BR; reg_fb_ref=https%3A%2F%2Fwww.facebook.com%2F%3Fstype%3Dlo%26jlou%3DAfe0qy59dIr6vAHnkp81bUe_fBoQZvzbSCC-DlC6PTUNZappnx7W6Mx8L1ujMMa_jNbUpui0M7_YUfiLiuGWWzrgnEQc9k1no4kFe50usSdB9A%26smuh%3D24564%26lh%3DAc9EK2ltZxJOphMY; reg_fb_gate=https%3A%2F%2Fwww.facebook.com%2F%3Fstype%3Dlo%26jlou%3DAfe0qy59dIr6vAHnkp81bUe_fBoQZvzbSCC-DlC6PTUNZappnx7W6Mx8L1ujMMa_jNbUpui0M7_YUfiLiuGWWzrgnEQc9k1no4kFe50usSdB9A%26smuh%3D24564%26lh%3DAc9EK2ltZxJOphMY; wd=1708x436; dpr=0.800000011920929");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_setopt($ch, CURLOPT_REFERER, "http://www.facebook.com");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$page = curl_exec($ch) or die(curl_error($ch));
echo $page;
Thanks, in advance.
Important is to understand login process. I see you send a lot of cookies with your curl request but i think this cookies are not alive already.
You need to do two curl requests: