通过curl连接到Facebook时密码错误

时间:2014-09-08 16:19:38

标签: php facebook curl

所以我试图用我的php脚本连接到facebook。但是,Facebook返回错误的密码错误,我确定我已经写好了密码。我的代码:

<?php
$ch = curl_init(); 
$url = "https://www.facebook.com/login.php?login_attempt=1";
$post = 'email='.urlencode('**@**.**').'&password='.urlencode('****');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
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, "https://www.facebook.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);   
curl_setopt($ch, CURLOPT_POST, 1);  
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);  
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');  
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
echo $txt = curl_exec ($ch);
?>

1 个答案:

答案 0 :(得分:0)

大声笑,我确定输入的名字是密码,我错了 - 输入名称是传递:D。