Python 2.x
headers = { "Content-type": "application/x-www-form-urlencoded" }
conn = httplib.HTTPConnection("www.paypal.com")
conn.request('POST', "/cgi-bin/webscr", "cmd=_notify-validate", headers)
res = conn.getresponse()
print res.read()
INVALID
INVALID is the correct response.
Python 1.5.2
conn = httplib.HTTP("www.paypal.com")
conn.putrequest('POST', "/cgi-bin/webscr")
conn.putheader('Content-type', 'application/x-www-form-urlencoded')
conn.endheaders()
conn.send('cmd=_notify-validate')
conn.getreply()
(200, 'OK', <mimetools.Message instance at 808e128>)
conn.getfile().read()
... Bunch of HTML because form wasn't posted properly ...
I've also tried it this way:
conn = httplib.HTTP("www.paypal.com")
conn.putrequest('POST', "/cgi-bin/webscr?cmd=_notify-validate")
conn.endheaders()
conn.getreply()
(200, 'OK', <mimetools.Message instance at 808c330>)
conn.getfile().read()
... Bunch of HTML because form wasn't posted properly ...
Any idea of how I can get this to work with Python 1.5.2?
Could I possibly just snag the 2.x httplib and it would
work under 1.5.2?
Thanks in advance,
--
Jeff "Shippy" Shipman E-Mail: shi...@nmt.edu
Computer Science Major ICQ: 1786493
New Mexico Institute of Mining and Technology
Homepage: http://www.nmt.edu/~shippy