ShaolinF Posted July 9, 2007 Share Posted July 9, 2007 Hi Guys, How can I do a remote login via cURL for facebook ? I can find scripts for other kinds such as hotmail/eby/gmail/paypal but I can't find one for facebook. Does anyone know where I can find one ? Or how to make it ? Quote Link to comment Share on other sites More sharing options...
ShaolinF Posted July 9, 2007 Author Share Posted July 9, 2007 Well here is a script Im working on, doesnt seem to work properly. Everytime I run the script facebook doesn't allow it. See code below: <?php $user = rawurlencode("$user"); $pass = "$pass"; $cookie_file_path = "cookie.txt"; $fp = fopen($cookie_file_path,'wb'); fclose($fp); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)"; $reffer = "http://login.facebook.com/login.php"; $reffer = "http://login.facebook.com/login.php"; $LOGINURL = "http://www.facebook.com"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$LOGINURL); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); $result = curl_exec ($ch); $LOGINURL = "http://www.facebook.com/"; //$POSTFIELDS ="email=$user&pass=$pass&action_login=Log+In"; $POSTFIELDS = "'email='.urlencode($user).'&pass='.urlencode($pass).'&login=Login')"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$LOGINURL); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_REFERER, $reffer); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); $result = curl_exec ($ch); curl_close ($ch); echo $result; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.