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.

curl to lua
#3
(22.01.2022, 22:58)Erwin van der Zwart Wrote: 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)

This works!

Bedankt Erwin!
Reply


Messages In This Thread
curl to lua - by baggins - 22.01.2022, 15:52
RE: curl to lua - by Erwin van der Zwart - 22.01.2022, 22:58
RE: curl to lua - by baggins - 22.01.2022, 23:07
RE: curl to lua - by admin - 24.01.2022, 07:08
RE: curl to lua - by baggins - 24.01.2022, 08:58

Forum Jump: