29.12.2016, 15:09
Hi,
I'm trying to write a script to control a Philips TV with json.
Based on an example in thread: http://forum.logicmachine.net/showthread...light=POST
I'm trying the following:
This fails:
Philips TV use Jointspace. Manual page for POST: http://jointspace.sourceforge.net/projec...-POST.html
Any tips?
I'm trying to write a script to control a Philips TV with json.
Based on an example in thread: http://forum.logicmachine.net/showthread...light=POST
I'm trying the following:
Code:
require('json')
require('socket.url')
require('socket.http')
fields = {key = "CursorLeft",}
data = json.encode(fields)
print(data)
post = 'data=' .. socket.url.escape(data)
print (post)
ip = '192.168.0.232:1925'
res, err = socket.http.request('http://'.. ip .. '/1/input/key', post)
print(res)
print( err)
This fails:
Code:
{"key":"CursorLeft"}
data=%7b%22key%22%3a%22CursorLeft%22%7d
<html><head><title>Bad Request</title></head><body>Bad Request</body></html>
400
Philips TV use Jointspace. Manual page for POST: http://jointspace.sourceforge.net/projec...-POST.html
Any tips?