Author Topic: Roku 3 control question  (Read 6235 times)

Offline Ds514

  • Full Member
  • ***
  • Posts: 189
  • Karma: +2/-0
  • Because automatic.
Re: Roku 3 control question
« Reply #15 on: January 30, 2014, 09:29:35 am »
This code also works and the timeout syntax is more consistent with the example from the wiki (getting that part right may be a good idea based on Richard's comment):

Code: [Select]
local http = require "socket.http"
local ltn12 = require "ltn12"
local util = require "util"
    http.timeout = 5
    local  body, code, headers, status = http.request {
        method = "POST",
        url = "http://192.168.0.235:8060/keypress/Back",
        source = ltn12.source.string(reqbody),
        headers =
                {
                        ["Connection"] = "Close",
                        ["Content-Type"] = "application/x-www-form-urlencoded",
a                },
        sink = ltn12.sink.table(respbody)

    }

There are lines in there that are almost certainly unneeded. Some may argue that it is worthwhile to whittle away the excess until you have code that does what you need without doing anything else.
« Last Edit: January 30, 2014, 09:31:08 am by Ds514 »

Offline blakem

  • Sr. Newbie
  • *
  • Posts: 47
  • Karma: +7/-0
Re: Roku 3 control question
« Reply #16 on: December 31, 2015, 09:15:13 pm »
Another possibly simpler method would be...
Code: [Select]
os.execute("curl -d '' http://192.168.0.235:8060/keypress/Back")