I'm newbie for the concept CURL. Now I'm trying to do the remote login to facebook using php curl. I have referred Refer,Refer 1,Refer 3,Refer 4.But it does not clear my doubt.
My code follows here:
define('HOME' , dirname(__FILE__));
//Create a curl object
$ch = curl_init();
if(is_callable('curl_init')){
echo "Enabled"."<br>";
}
else
{
echo "Not enabled"."</br>";
}
$login_url = 'https://www.facebook.com/login/';
//These are the post data username and password
$post_data = array('email'=>'MY_EMAIL_ID','pass'=>'gdfgg');
//Set the useragent
$agent = $_SERVER["HTTP_USER_AGENT"];
//echo $agent;
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
//Set the URL
curl_setopt($ch, CURLOPT_URL, $login_url );
//This is a POST query
curl_setopt($ch, CURLOPT_POST, 1 );
//Set the post data
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
//We want the content after the query
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Follow Location redirects
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
/*
Set the cookie storing files
Cookie files are necessary since we are logging and session data needs to be saved
*/
curl_setopt($ch, CURLOPT_COOKIEJAR, HOME. '/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, HOME. '/cookie.txt');
//Execute the action to login
$postResult = curl_exec($ch);
curl_close($ch);
echo $postResult;
When I checked in my firefox DOM section,it shows

In my cookie.txt, I have no code in that,it stands empty even though I changed the permission to all.
Question 1 : What the above code will do?
Question 2 : How can I check its working or not in DOM?
Question 3 : It will work in local?