"ludwig.benitez" wrote:
hi guys... this is the last question on the subject.
i wonder how to retrieve data from mysql. I know that i can't have use of mysql directly with brigthscript.
Sorry for the inconvenience, many thank you very much.
"gonzotek" wrote:
You'll need to create a server-side script in one language or another with which you are comfortable. The Roku code will call the script (e.g. http://server.com/getVideos.php?genre=SciFi&year=1968&director=Kubrick). The script will connect to your mysql server instance, perform the necessary query, retrieve the results, then format them into an xml(or JSON or other structured data format) string, then send that formatted data to the Roku.
"gonzotek" wrote:
... then format them into an xml(or JSON or other structured data format) string, then send that formatted data to the Roku.
"ludwig.benitez" wrote:"gonzotek" wrote:
... then format them into an xml(or JSON or other structured data format) string, then send that formatted data to the Roku.
Dear gonzotek,
I have done the xml file on the server, written in php (https://www.dropbox.com/s/84ll97q5h4v1jef/xmlroku.png)
Now, you said: "then send that formatted data to the Roku."
How do I retrieve data from the roku channel?. With great humility I welcome your comments. Thanks!
transferObj = CreateObject("roUrlTransfer")
transferObj.SetURL("http://server/suscripcion.php")
xml = CreateObject("roXMLElement")
xml.Parse(transferObj.gettostring())
print xml.post.titulo.getText()
"gonzotek" wrote:
You can retrieve the data using the roUrlTransfer system component, then parse it with roXMLElement:transferObj = CreateObject("roUrlTransfer")
transferObj.SetURL("http://server/suscripcion.php")
xml = CreateObject("roXMLElement")
xml.Parse(transferObj.gettostring())
print xml.post.titulo.getText()
Function ShowMessageDialog() As Void
'create here the transfer with script on the server
transferObj = CreateObject("roUrlTransfer")
transferObj.SetURL("http://www.rodeobiobio.cl/Suscripcion/file.xml")
xml = CreateObject("roXMLElement")
xml.Parse(transferObj.GetToString())
var_uno = xml.rsp.photos.photo[0].GetText()
port = CreateObject("roMessagePort")
dialog = CreateObject("roMessageDialog")
dialog.SetMessagePort(port)
dialog.SetTitle("blablabla")
dialog.SetText("más blablabla")
dialog.SetText("var_uno")
dialog.AddButton(1, "Validar")
dialog.EnableBackButton(true)
dialog.Show()
While True
dlgMsg = wait(0, dialog.GetMessagePort())
If type(dlgMsg) = "roMessageDialogEvent"
if dlgMsg.isButtonPressed()
if dlgMsg.GetIndex() = 1
exit while
end if
else if dlgMsg.isScreenClosed()
exit while
end if
end if
end while
End Function
var_uno = xml.rsp.photos.photo[0].GetText()
var_uno = xml.photos.photo[0].GetText()
print var_uno
dialog.SetText("var_uno")
dialog.SetText(var_uno)
<photo id="3131875696" owner="21963906@N06" secret="f248c84625" server="3125" farm="4" title="VNY 16R" ispublic="1" isfriend="0" isfamily="0">HERE IS SOME TEXT. THIS TEXT SHOULD APPEAR IN WHEN var_uno IS PRINTED!</photo>
<?xml version="1.0" encoding="utf-8" ?>
<validacion>
<cliente id="3872" />
</validacion>
BrightScript Debugger> xfer=createobject("roURlTransfer")
BrightScript Debugger> xfer.seturl("http://www.rodeobiobio.cl/Suscripcion/file.xml")
BrightScript Debugger> test=xfer.gettostring()
BrightScript Debugger> ?test
<?xml version="1.0" encoding="utf-8" ?>
<validacion>
<cliente id="3872" />
</validacion>
BrightScript Debugger> xml=createobject("roxmlelement")
BrightScript Debugger> ?xml.parse(test)
true
BrightScript Debugger> ?xml.cliente@id
3872
BrightScript Debugger>