我正在使用NodeMCU固件的HTTP模塊使用以下代碼。根據文檔,HTTP和HTTPS URL都可以工作。如何在NodeMCU HTTP模塊中使用HTTPS發佈請求
https://nodemcu.readthedocs.io/en/master/en/modules/http/#httppost
當我使用的 'https' 雖然我得到錯誤。 'http'對我來說工作正常。對於代碼中的URL,我面臨以下錯誤。
「純HTTP請求已發送到HTTPS端口」。
請幫忙。
http.post('https://maker.ifttt.com/trigger/......',
'Content-Type: application/json\r\n',
'{"value1":"mainlobby"}', function(code, data)
if (code < 0) then
print("HTTP request failed")
else
print(code, data)
end
end
謝謝。我錯過了在固件中添加SSL支持。雖然看起來像在nodemcu 2.0.0 build中,即使在添加ssl支持之後,它也不起作用。雖然我得到了我的查詢的答案。再次感謝。 http://stackoverflow.com/questions/42414431/nodemcu-lua-http-get-disconnected-with-error-8-what-is-error-8 – Jatinder