''' Richard Burns November 28, 2010 Test script which passes information to the class apache server via the POST method. The server script currently captures this information and appends it to a testing output file, demonstrating one way that we can pass data to the server for it to record. Taken from: http://docs.python.org/library/httplib.html TODO: test size limitations of the POST ''' import httplib, urllib #params = urllib.urlencode({'milk': 1, 'eggs': 2, 'bacon': 0}) params = urllib.urlencode({'data': "test data from python again"}); headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} conn = httplib.HTTPConnection("cisc367.acad.cis.udel.edu:80") #conn.request("POST", "/cgi-bin/query", params, headers) conn.request("POST", "/post-server.php", params, headers) response = conn.getresponse() print response.status, response.reason data = response.read() conn.close()