I'm developing an API in my work, and I need to develop something in python2 that sends a form to the server through POST, I saw some questions here in the forum and I could not find anything that worked ... I need the community to help me !
Well, I'm using this code to understand logic and move on to the senior programmer of the project:
import json
import urllib2
data = {
'id' : 1, 'number': 556291406183, 'message' : 'Hello'
}
req = urllib2.Request('http://lsweb.net.br/gabriel.php')
req.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(req, json.dumps(data))
But I'm not getting results with this code, so it does not send anything to the server. The intention was to send to the server page in POST and POST to read in PHP. HELP ME