【发布时间】:2016-06-29 12:54:41
【问题描述】:
我想使用运行 NodeMCU 的 ESP8266 对 googleapi.com 执行 GET 请求,以从 google Calendar API 获取一些数据。该网站仅允许安全连接 (HTTPS/SSL)。
首先,我一直在尝试连接到 google.com(安全)尝试一下,但也没有成功。这是 LUA 代码:
conn=net.createConnection(net.TCP, 1)
conn:on("receive", function(sck, c) print(c) end )
conn:on("connection", function(conn)
print("connected")
conn:send("HEAD / HTTP/1.1\r\n"..
"Host: google.com\r\n"..
"Accept: */*\r\n"..
"User-Agent: Mozilla/4.0 (compatible; esp8266 Lua;)"..
"\r\n\r\n")
end )
conn:on("disconnection", function(conn) print("disconnected") end )
conn:connect(443,"google.com")
什么都没有被触发(即使是“已连接”)。
我还通过选择 SSL 支持从网站http://nodemcu-build.com 下载了 最新 版本的 nodemcu(主分支)。
NodeMCU custom build by frightanic.com
branch: master
commit: c8037568571edb5c568c2f8231e4f8ce0683b883
SSL: true
谁能告诉我我做错了什么?有人在Reddit 上报告了这个问题,但没有给出最终解决方案。
【问题讨论】:
标签: ssl https lua esp8266 nodemcu