So here is a code for making simple php curl login
<?php
spcitsFacebook(‘Your Email’,'Your Password’);
function spcitsFacebook($login_email, $login_pass, $debug=false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://login.facebook.com/login.php?m=m&refsrc=http%3A%2F%2Fm.facebook.com%2Fhome.php&fbb=rd17cd94c&refid=8′);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘email=’ . urlencode($login_email) . ‘&pass=’ . urlencode($login_pass) . ‘&login=’ . urlencode(“Log in”));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, “my_cookie_123.txt”);
curl_setopt($ch, CURLOPT_COOKIEFILE, “my_cookie_123.txt”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, “Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)”);
echo curl_exec($ch);
curl_close($ch);
}
?>
Further I made the code to store the logged in page to a text file which can be checked by you over here
<?php
spcitsFacebook(‘Your Email’,'Your Password’);
function spcitsFacebook($login_email, $login_pass, $debug=false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://login.facebook.com/login.php?m=m&refsrc=http%3A%2F%2Fm.facebook.com%2Fhome.php&fbb=rd17cd94c&refid=8′);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘email=’ . urlencode($login_email) . ‘&pass=’ . urlencode($login_pass) . ‘&login=’ . urlencode(“Log in”));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, “my_cookie_123.txt”);
curl_setopt($ch, CURLOPT_COOKIEFILE, “my_cookie_123.txt”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, “Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)”);
echo curl_exec($ch);
curl_close($ch);
}
?>
Further I made the code to store the logged in page to a text file which can be checked by you over here
<?php
spcitsFacebook(‘xxxxxx’,'xxxxxx’);
function spcitsFacebook($login_email, $login_pass, $debug=false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://login.facebook.com/login.php?m=m&refsrc=http%3A%2F%2Fm.facebook.com%2Fhome.php&fbb=rd17cd94c&refid=8′);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘email=’ . urlencode($login_email) . ‘&pass=’ . urlencode($login_pass) . ‘&login=’ . urlencode(“Log in”));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, “my_cookie_123.txt”);
curl_setopt($ch, CURLOPT_COOKIEFILE, “my_cookie_123.txt”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, “Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)”);
$fp = fopen(‘spcits.txt’, ‘w’);
curl_setopt($ch, CURLOPT_FILE, $fp);
echo curl_exec($ch);
fclose($fp);
curl_close($ch);
}
?>
No comments:
Post a Comment