18.02.2019, 18:31
How to execute more then one http request in the same web sessions?
I have a request for login and another request for opening the door. But now i received: 401 Authorization Required
If i execute both statements in the browser it works.
Code:
function openDoor(iLoxxId)
require('socket.http')
socket.http.TIMEOUT = 5
local urlLogin = 'http://'..wl_IP..'/login.cgi?Source=Webpage&Username='..wl_USR..'&Password='..wl_PWD
local urlAccess = 'http://'..wl_IP..'/setRemoteAccess.cgi?Source=Webpage&LoxxId='..iLoxxId..'&Action=Start'
wl_login_data = socket.http.request(urlLogin)
log(wl_login_data)
wl_access = socket.http.request(urlAccess)
log(wl_access)
end
openDoor(19)
I have a request for login and another request for opening the door. But now i received: 401 Authorization Required
If i execute both statements in the browser it works.