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

roUrlTransfer ??

Need some help. I am working on a private channel. Included in my pkg I have a folder called channel. In the folder I have a single txt file with up to (3) lines text. The text is basic info about about the channel. Once the channel is selected, the server will need to read the text file. I first wanted to copy the txt file from the roku down to the server but have not been successful in doing that so I thought about using a url transfer as follows:
channelinfo=ReadAsciiFile("pkg:/channel/channel.txt")
xfer=CreateObject("roUrlTransfer")
xferport=CreateObject("roMessagePort")
xfer.SetMessagePort(xferport)
channelfile="http://xxx.xxx.xxx.xxx/channelinfo.php?channelfile=" + channelinfo
xfer.SetUrl(channelfile)
response= xfer.AsyncGetToString()
I know the above works, I can use a print statement on the channelinfo and it shows the text in the debug console. The exact url transfer works on another function I am running to get the roku ip, pass it to php, save to server. All that works. For some reason it doesn't work for passing the channelinfo to the server. Any advice or help would be appreciated. If I can just copy the file down from roku that would be great.
Thanks
0 Kudos
3 REPLIES 3
TheEndless
Channel Surfer

Re: roUrlTransfer ??

It doesn't look like you're URL encoding the channelInfo anywhere. You can't just tack text onto the end of a URL. You'll need to encode it. Try this:
channelfile="http://xxx.xxx.xxx.xxx/channelinfo.php?channelfile=" + xfer.UrlEncode(channelinfo)
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
btpoole
Channel Surfer

Re: roUrlTransfer ??

Thank you The Endless, worked perfect. Odd, I didn't do that when passing the ip address, but then again I didn't read the ip address from a file, it came from the GetIPAddrs function.
Thanks again
0 Kudos
RokuMarkn
Visitor

Re: roUrlTransfer ??

An IP address doesn't contain any characters that need to be escaped.

--Mark
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.