我正在尝试向"http://192.168.1.236:8081/send.php"
代码发送 HTTP 获取请求:
params = urllib.urlencode({'content': str(error)})
head = {'Host': '192.168.1.236', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0',
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3",
"Accept-Encoding": "gzip, deflate", "Connection": "keep-alive"}
conn = httplib.HTTPConnection(IP, PORT)
conn.request(method="GET", url="/send.php", body=params, headers=head)
r = conn.getresponse()
print r.read()
conn.close()
然后打印结果是'Array\n(\n)\nmail content empty'。但是我通过模拟在浏览器中使用url发送get请求得到的结果"http://192.168.1.236:8081/send.php?content=11212121212121212"
是“Array ([content] => 11212121212121212) Array ()邮件内容为空”。谁能告诉我大概是什么问题。