I have tried multiple ways of posting information to a website and have failed.
my first attempt was out of the docs:
- import httplib, urllib
-
params = urllib.urlencode({'email' : 'a@a.com', 'password' : 'pass'})
-
h = httplib.HTTP("login.myspace.com:80")
-
h.putrequest("POST", "/index.cfm?fuseaction=login.process&")
-
h.putheader("User-Agent", "Mozilla/5.0 <Windows; U; Windows NT 5.1; en-US; rv;1.8.0.6> Gecko/20060728 Firefox/1.5.0.6")
-
h.putheader("Content-length", "%d" % len(params))
-
h.putheader('Accept', 'text/plain')
-
-
h.endheaders()
-
h.send(params)
-
reply, msg, hdrs = h.getreply()
-
print reply # should be 200
-
data = h.getfile().read() # get the raw HTML
-
print data
this returned a page denying access
and then tried:
- import httplib, urllib
-
params = urllib.urlencode({'email' : 'ezikz@bonbon.net', 'password' : 'dicksuck'})
-
data = urllib.urlopen("http://login.myspace.com/index.cfm?fuseaction=login.process&:80", params).read()
-
print data
This returned a page that asked me if i wanted to sign up, which confused me even more.
all i want to do is post this form:
[HTML]<form method='POST' enctype='multipart/form-data' action='http://login.myspace.com/index.cfm?fuseaction=login.process&'>
<input type="text" name="email" >
<input type="password" name="password" >
<input type="submit" value="Login"/>[/HTML]
Please help i was thinking maybe the site did browser sniffing and only allowed certain types. i dont know.