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.

shell script to LUA
#3
Thanks I looked an example! Here is the result:

Code:
require('socket.http') socket.http.TIMEOUT = 5 data = "{'username':'user', 'password':'12345'}" url1 = 'https://10.10.11.2:8443/api/login' url2 = 'https://10.10.11.2:8443/api/s/default/stat/sta' res, err, hdrs = socket.http.request(url1,data) if res then   tbl = {}   res, err = socket.http.request({     url = url2,     headers = {       cookie = hdrs['set-cookie']     },     sink = ltn12.sink.table(tbl),   })   if res then     resp = table.concat(tbl)     log(resp)   else     alert('request 2 failed: ' .. tostring(err))   end else   alert('request 1 failed: ' .. tostring(err)) end

But it still gives an error.


Code:
* string: {"meta":{"rc":"error","msg":"api.err.LoginRequired"},"data":[]}


I am not good at scripts, may you help me ?

Thanks a lot!
Reply


Messages In This Thread
shell script to LUA - by edos - 03.02.2020, 23:31
RE: shell script to LUA - by admin - 04.02.2020, 07:48
RE: shell script to LUA - by edos - 04.02.2020, 18:03
RE: shell script to LUA - by admin - 05.02.2020, 07:31
RE: shell script to LUA - by edos - 05.02.2020, 08:53
RE: shell script to LUA - by admin - 05.02.2020, 09:21
RE: shell script to LUA - by edos - 05.02.2020, 11:30
RE: shell script to LUA - by admin - 05.02.2020, 12:11
RE: shell script to LUA - by benanderson_475 - 23.03.2020, 02:03
RE: shell script to LUA - by admin - 23.03.2020, 07:14

Forum Jump: