Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
btpoole
Level 8

Send roarray to server

Trying to pass a roarray to my server thru the url. I can do string with no problem but getting a type mismatch when setting the url. Looks something like

serverurl="http://myserver/myserversecript.php?filename="+myfile+"&myarray="+myarray

I can use the same code and include and send one element of the array as a string and works fine

serverurl="http://myserver/myserversecript.php?filename="+myfile+"&myarray="+myarray[0].title

Can the entire array be sent at one time. Thought about looping thru myarray but thought there had to be another way to avoid making so many calls.
0 Kudos
2 REPLIES 2
belltown
Level 9

Re: Send roarray to server

I would do something like this:
ut = CreateObject("roUrlTransfer")
myfileEscaped = ut.Escape(myfile)
myarrayJson = FormatJson(myarray)
myarrayJsonEscaped = ut.Escape(myarrayJson)
serverurl="http://myserver/myserversecript.php?filename="+myfileEscaped+"&myarray="+myarrayJsonEscaped
https://github.com/belltown/
0 Kudos
btpoole
Level 8

Re: Send roarray to server

"belltown" wrote:
I would do something like this:
ut = CreateObject("roUrlTransfer")
myfileEscaped = ut.Escape(myfile)
myarrayJson = FormatJson(myarray)
myarrayJsonEscaped = ut.Escape(myarrayJson)
serverurl="http://myserver/myserversecript.php?filename="+myfileEscaped+"&myarray="+myarrayJsonEscaped


Thanks belltown, this worked.
0 Kudos