Hello,

I've done all my searching online regarding form + cookie authentication, but I can't seem to figure out why my program isn't working. I don't know whether i'm missing out on some http fundamentals, encryption or something.

Here's a sample code of me attempting to log into facebook. I used firebug to see what its posting, and I replicated it under values.

Thank you very very very much,
Louis

import urllib
import urllib2

user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
values = {
'charset_test' : ',,,,水,Д,Є',
'e-mail' : 'fcukfest@hotmail.com',
'next' : 'http://www.facebook.com/home.php',
'pass' : 'fake password',
'return_session' : '0',
'version' : '1.0' }
headers = { 'User-Agent' : user_agent }

opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
urllib2.build_opener(urllib2.HTTPHandler(debuglevel=1))
urllib2.install_opener(opener)
params = urllib.urlencode(dict())
f = opener.open('https://login.facebook.com/login.php?login_attempt=1', params)
data = f.read()
f.close()
f = opener.open('http://www.facebook.com/home.php?ref=home')
data = f.read()
f.close()