I use the following example: http://www.w3schools.com/php/php_forms.asp
When I run it from browser, I see the results in the browser:
Welcome John
Your email address is john.doe@example.com
When I run python POST http request:
import httplib, urllib
params = urllib.urlencode({'@name': 'John','@email': 'John.doe@example.com'})
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/html"}
conn = httplib.HTTPConnection("10.0.0.201")
conn.request("POST","/welcome.php",params, headers)
response = conn.getresponse()
print "Status"
print response.status
print "Reason"
print response.reason
print "Read"
print response.read()
conn.close()
I see the following:
Status
200
Reason
OK
Read
<html>
<body>
Welcome <br>
Your email address is:
</body>
</html>
The question is: How to receive POST request data in python?