SOLUTION: connect to website providing login & pwd

-:fs fs at floSoft.net
Mon Oct 1 05:25:26 EDT 2001


SOLUTION

import httplib
import urllib

#notice that the keys are the name=fields of the login-form
params = {'login':'myLoginName', 'passwort':'myPassword'}
params = urllib.urlencode(params)
h = httplib.HTTP("<host>")
h.connect()

# the cgi-action of the login-form
h.putrequest('POST', '/doSomthing.cgi')
h.putheader("Content-type", "application/x-www-form-urlencoded")
h.putheader("Content-length", "%d" % len(params))
h.endheaders()
h.send(params)

status, reason, headers = h.getreply()
print status
print reason
print headers
print h.getfile().read()

----------------------------------------------------------------------

this works in my case, where obviously no security is implemented,
but only the fillings of two textfields are sent to the server

THX TO ALL INVOLVED

steindl friedrich
        (-:fs)





More information about the Python-list mailing list