几天前,我发布了有关 nodeMcu POST 请求的问题,找不到任何解决方案,我接下来要尝试:
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end )
conn:on("connection", function(c)
conn:send("GET /wifi?temp=24&hum=12&alert HTTP/1.1\r\n"
.."Host: www.weatherman.bl.ee\r\n"
.."Cache-Control: no-cache\r\n"
.."Connection: keep-alive\r\nAccept: */*\r\n\r\n")
end)
conn:connect(80, "www.weatherman.bl.ee")
但是这个请求以 301 错误回复我
HTTP/1.1 301 Moved Permanently
Date: Mon, 02 Nov 2015 20:03:50 GMT
Server: Apache
Location: http://www.weatherman.bl.ee/wifi/?temp=24&hum=12&alert
Content-Length: 270
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
有任何想法吗?可能是标题的问题?邮递员执行请求很好