-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathexample.lua
More file actions
32 lines (25 loc) · 793 Bytes
/
example.lua
File metadata and controls
32 lines (25 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
-- ESP8266-HTTP Library
-- Written 2014 by Tobias Mädel (t.maedel@alfeld.de)
-- Licensed unter MIT
-- Download a file
tmr.wdclr()
httpDL = require("httpDL")
collectgarbage()
-- IP/Host URL Destination Finished Callback
httpDL.download("10.4.0.5", 80, "/api/esp8266/lichtTreppe/main.lua", "main2.lua", function (payload)
-- Finished downloading
end)
httpDL = nil
package.loaded["httpDL"]=nil
collectgarbage()
-- sending a GET request and get the return value
tmr.wdclr()
http = require("http")
collectgarbage()
-- IP/Host URL GET Arguments Finished Callback
http.get("10.4.0.5", 80, "/api/esp8266/lichtTreppe/main.lua", {foo = "bar"}, function (payload)
print(payload)
end)
http = nil
package.loaded["http"]=nil
collectgarbage()