As the title says... Chat on...

User avatar
By markus507
#60547 I'm fairly new to NodeMCU developing and I cannot get http.get to get work.

I've created an Image over http://nodemcu-build.com with the following modules:
bit, dht, file, gpio, http, i2c, net, node, tmr, u8g, uart, wifi, tls

The NodeMCU is connected to WiFi. But when I execute the following Code:
Code: Select allprint(wifi.sta.getip())

http.get("http://nodemcu-build.com", nil, function(code, data)
  if (code < 0) then
    print("HTTP request failed")
  else
    print(code, data)
  end
end)


I get the following Response:
Code: Select alldofile('http.lua')
192.168.1.128   255.255.255.0   192.168.1.11
> HTTP client: DNS failed for nodemcu-build.com
HTTP request failed



What's wrong?

Thank you
Markus
User avatar
By douglasjam
#64217 I have the same issue, did you manage to fix it?

after wifi success connection

Code: Select allhttp.get("http://httpbin.org/ip", nil, function(code, data, result)
        if (code < 0) then
            print("HTTP request failed")
        else
            print(code, data)
        end
    end)


output

Code: Select allHTTP client: DNS failed for httpbin.org
HTTP request failed