我编写了一个简单的PHP cURL facebook登录信息。我面临一些问题。
现在我怎样才能解决他的问题?我的代码在下面
注意:我无法发布2个以上的链接,因此我会在pastebin.com上粘贴链接和Cookie代码。
登录代码:
<?php
$ch = curl_init(); //initialize
/*set login info*/
$info['email'] = 'md60541@gmail.com'; //email or phone
$info['pass'] = 'fake1538id'; //password
$data = http_build_query($info); //declear login info
/* cURL Stacture*/
curl_setopt($ch , CURLOPT_RETURNTRANSFER, 1); //transfer ture
curl_setopt($ch , CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); //get user agent from broser
curl_setopt($ch , CURLOPT_URL, 'https://www.facebook.com/login.php'); //login url
curl_setopt($ch , CURLOPT_COOKIEFILE, getcwd().'/cookie.txt'); //cookie files
curl_setopt($ch , CURLOPT_COOKIEJAR, getcwd().'/cookie.txt');
curl_setopt($ch , CURLOPT_POST , 1); //method
curl_setopt($ch , CURLOPT_POSTFIELDS, $data); // set post data
curl_setopt($ch , CURLOPT_SSL_VERIFYPEER, 0); //set SSL veriyfication false
curl_setopt($ch , CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch , CURLOPT_FOLLOWLOCATION, 1);
curl_exec($ch); //execute info
/*After login*/
curl_setopt($ch, CURLOPT_URL, "http://www.facebook.com"); //redirect to
$isOK = curl_exec($ch) or die(curl_exec($ch)); // for check if login okk.
echo $isOK;
curl_close($ch); //close curl login
&GT;
Cookie内容: http://pastebin.com/raw/3h5ereMQ