From: Fontanel, L. <Lau...@gl...> - 2001-12-03 13:31:08
|
Robert, You can just use the Python httplib module. It works great. The documentation says: import httplib, urllib params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) h = httplib.HTTP("www.musi-cal.com:80") h.putrequest("POST", "/cgi-bin/query") h.putheader("Content-type", "application/x-www-form-urlencoded") h.putheader("Content-length", "%d" % len(params)) h.putheader('Accept', 'text/plain') h.putheader('Host', 'www.musi-cal.com') h.endheaders() h.send(params) reply, msg, hdrs = h.getreply() print reply # should be 200 data = h.getfile().read() # get the raw HTML I've modified this script to do exactly what you're trying to do. The two main gotchas are: - setting the content type to what your servlet is expecting. - setting the content length correctly. If you're using XML-RPC, set the content type to "text/xml". Hope this helps, Laurent Fontanel http://www.globalcrossing.com |