22.01.2022, 22:58
(This post was last modified: 22.01.2022, 23:01 by Erwin van der Zwart.)
Try this:
Code:
require('socket.http')
require("ltn12")
res = {}
body = '{"jsonrpc":"2.0","id":1,"method":"Input.Down"}'
socket.http.request({
url = "http://user:passwd@192.168.0.24:8080/jsonrpc",
method = 'POST',
sink = ltn12.sink.table(res),
headers = {
['content-length'] = #body,
['content-type'] = 'application/json',
},
source = ltn12.source.string(body),
})
log(res)