Current Lua downloadable firmware will be posted here

User avatar
By Spar
#70047 I have a problem with doing by myself a http.post() request. I want to perform API requests on NodeMCU based on ESP8266 with Lua language. The first problem that i met was "Plain HTTP on HTTPS adress". For now it says "bad token", so, it means that he didn't receive my post parameters.

How it need to be correct?

Code: Select allhttp.post("http://www.2level.1level/api.php","Content-Type: text/plain","token=mytokenhere&arg1=argumentforrequest",
  function(code, data)
    if (code < 0) then
    print("HTTP request failed")
  else
    print(code, data)
  end
end)

Usually i use GMod Lua for making requests. Code there will be easy:

Code: Select allhttp.Post("https://www.2level.1level/api.php",{token=mytokenhere,arg1=argumentforrequest},function(txt) end,function(txt) end)

Imagehttp.Post on GMod Lua Wiki