This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

HTTP GET with authorisation
#2
200 status means that requests work correctly, you just have to get the response like this:
Code:
-- load required modules
http = require("socket.http")
mime = require("mime")
ltn12 = require("ltn12")

t = {}

r, c, d, e = http.request {
  url = "http://demo.traccar.org/api/positions/",
  headers = { authorization = "Basic " .. (mime.b64("login:password")) },
  sink = ltn12.sink.table(t)
}

response = table.concat(t)
log(response)
Reply


Messages In This Thread
HTTP GET with authorisation - by buuuudzik - 29.10.2016, 22:11
RE: HTTP GET with authorisation - by admin - 31.10.2016, 07:44
RE: HTTP GET with authorisation - by edgars - 15.11.2016, 13:44

Forum Jump: