Way to load url info from remote file?

Hello,
Is there a way to have a text file with an url in it on my server and have my app use the url in the file?

I want to have an image in my app that when clicked opens the url in the text file. By having the url in the text file I won’t have to update my app each time I want to change the url.

Thanks,
Tayari
[import]uid: 100901 topic_id: 33269 reply_id: 333269[/import]

Sure, you can use network.download() to get the text file downloaded, then open it using Lua’s file operators, read the URL out of the file and then do a system.openURL() to it.

You may run into problems on Android if your server gzips text files. I ran into that in a project I’m working on and ended up having to write a little PHP script that reads the file in and output the data in JSON format and I switched from network.download to network.request. In my case since there was lots of tabular data the 2nd way was the better way anyway.

[import]uid: 19626 topic_id: 33269 reply_id: 132195[/import]

Thanks,
Will look into this. Will make little news broadcasts a lot easier.

[import]uid: 100901 topic_id: 33269 reply_id: 132198[/import]

Sure, you can use network.download() to get the text file downloaded, then open it using Lua’s file operators, read the URL out of the file and then do a system.openURL() to it.

You may run into problems on Android if your server gzips text files. I ran into that in a project I’m working on and ended up having to write a little PHP script that reads the file in and output the data in JSON format and I switched from network.download to network.request. In my case since there was lots of tabular data the 2nd way was the better way anyway.

[import]uid: 19626 topic_id: 33269 reply_id: 132195[/import]

Thanks,
Will look into this. Will make little news broadcasts a lot easier.

[import]uid: 100901 topic_id: 33269 reply_id: 132198[/import]