HTTP 客户端:因错误而断开连接:-114 Lua

时间:2021-02-07 22:28:25

标签: http https lua esp8266 nodemcu

我正在尝试使用我的 nodemcu 与 thingspeak 进行交流。我正在使用 lua,我正在尝试使用 get 请求推送数据,但我得到(字面意思...)这个错误:

> HTTP client: Disconnected with error: -114
HTTP client: Connection timeout
HTTP request failed

我不知道为什么。我已连接到我的 wifi,这是我的代码:

url = "https://api.thingspeak.com/update.json?api_key=XXXXXXXXXXXXXXXXX&field1=" .. temp
print(url)
http.get(url, nil, function(code, data)
    if (code < 0) then
      print("HTTP request failed")
    else
      print(code, data)
    end
  end)

这是我的模块:

crypto,dht,file,gpio,http,mdns,mqtt,net,node,pwm,sjson,spi,tmr,tsl2561,uart,websocket,wifi,tls

有什么想法吗?我不知道该怎么办。

0 个答案:

没有答案