Example of a webclient with DNS lookup
Posted: Tue Dec 02, 2014 6:55 am
This is my example of using a lua client to update a databse on my webserver.
It calls a .php page that update a MySql database every 30 seconds.
You can see the result here (showing only the last 25 entrys):
http://www.ernstc.dk/sensor.php
One thing that I can't figure out is why we have to use the IP number.
Wouldn't it be posibble to let the esp do the DNS lookup
It calls a .php page that update a MySql database every 30 seconds.
You can see the result here (showing only the last 25 entrys):
http://www.ernstc.dk/sensor.php
One thing that I can't figure out is why we have to use the IP number.
Wouldn't it be posibble to let the esp do the DNS lookup
Code: Select all
tmr.alarm(30000, 1, function()
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end )
conn:connect(80,"46.30.212.238")
conn:send("GET /esp.php?tekst="..adc.read(0) .."&heap="..node.heap().." HTTP/1.1\r\nHost: www.ernstc.dk\r\n"
.."Connection: keep-alive\r\nAccept: */*\r\n\r\n")
end)