【发布时间】:2020-03-31 12:18:06
【问题描述】:
几天前我发布了关于 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
有什么想法吗?可能是标题的问题? 邮递员执行请求很好
【问题讨论】:
-
我尝试了相同的代码,它为我返回
Data saved succesfully。可能还有其他原因导致 301 重定向? -
节点 mcu 固件上的代码相同?如果是,请告诉我您的版本号,请
-
不在nodemcu上;但是使用 luasocket 库的相同 lua 代码(和 curl 中的相同标头)。
-
你应该接受正确的答案。
标签: .htaccess redirect esp8266 nodemcu