Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
btpoole
Channel Surfer

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
Roku Guru

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
0 Kudos
btpoole
Channel Surfer

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