lmsilva
14 years agoVisitor
Having trouble making an http connection
Dear all,
I'm playing around with the sample code in the SDK and I'm trying to capture the "up" key in the custom video player example, sending the event to a php script I have and displaying it in the screen:
'If the <UP> key is pressed, jump out of this context:
else if msg.isRemoteKeyPressed()
index = msg.GetIndex()
print "Remote button pressed: " + index.tostr()
m.help = "Remote button pressed: " + index.tostr()
if index = 2 '<UP>
url = "http://192.168.1.217/myscript.php?keypress=" + index
m.help = m.help + "You pressed up! This is where we would capture your vote! ;o)"
xfer = CreateObject("roURLTransfer")
xfer.SetURL("http://192.168.1.217/myscript.php?keypress=" + xfer.Escape(index))
response = xfer.GetToString()
m.help = m.help + response
m.setup()
else if index = 3 '<DOWN> (toggle fullscreen)
...
Any idea why my box hangs when I do this?
I also tried copying the urlUtils.brs from another sample and using:
http = NewHttp("http://192.168.1.217/myscript.php?keypress=" + xfer.Escape(index))
rsp = http.GetToStringWithRetry()
But that also hangs my Roku...
Any thoughts?
p.s. on an unrelated matter, is BrightScript CaseSenSitive?
Thanks,
Luis
I'm playing around with the sample code in the SDK and I'm trying to capture the "up" key in the custom video player example, sending the event to a php script I have and displaying it in the screen:
'If the <UP> key is pressed, jump out of this context:
else if msg.isRemoteKeyPressed()
index = msg.GetIndex()
print "Remote button pressed: " + index.tostr()
m.help = "Remote button pressed: " + index.tostr()
if index = 2 '<UP>
url = "http://192.168.1.217/myscript.php?keypress=" + index
m.help = m.help + "You pressed up! This is where we would capture your vote! ;o)"
xfer = CreateObject("roURLTransfer")
xfer.SetURL("http://192.168.1.217/myscript.php?keypress=" + xfer.Escape(index))
response = xfer.GetToString()
m.help = m.help + response
m.setup()
else if index = 3 '<DOWN> (toggle fullscreen)
...
Any idea why my box hangs when I do this?
I also tried copying the urlUtils.brs from another sample and using:
http = NewHttp("http://192.168.1.217/myscript.php?keypress=" + xfer.Escape(index))
rsp = http.GetToStringWithRetry()
But that also hangs my Roku...
Any thoughts?
p.s. on an unrelated matter, is BrightScript CaseSenSitive?
Thanks,
Luis