几天前,我很担心nodeMcu发布采购信息发布的问题,无法找到任何解决方案,我敢尝试下一步:GET请求NodeMCU(ESP8266)301错误
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
任何想法?可能是标题的问题? 邮递员执行请求罚款
我尝试了相同的代码,并返回'成功保存成功'给我。也许还有别的原因导致301重定向? – hjpotter92
节点mcu固件上的相同代码?如果是,请告诉我您的版本号,请 – once2go
不在nodemcu;但使用luasocket库的lua代码(和curl中的相同头文件)相同。 – hjpotter92