Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Getting a news text from a server?
Started by d.mach Nov 27 2019 12:08 AM

- - - - -
3 replies to this topic
server news network
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 926 posts
  • Corona SDK

I wonder how I can load and show a news text from an external server, so I can show actual info inside a game by just updating the news text on the server and not have to upload a new game version?

How can this be done?

 



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,103 posts
  • Corona SDK

There are quite a few ways of doing this and what the easiest solution is probably depends on your personal experience and skills.

 

You could do LAMP stack, or just use simple PHP or JavaScript functions, or push notifications as well, I guess.

 

The simplest you could get away with would be to create a function in your app that checks a PHP file on your server for if there are news available. If you plan to just show one message at a time, that you'd manually change if and when needed, then you could simply run file_get_contents() to load your message from another file on your server and return that to the app.


  • pixec likes this

[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,539 posts
  • Enterprise

You could just put a text file on a web server you have access to and use network.download() to fetch it. You would have to have a way to push the news file to the server (maybe just use FTP) and be able to delete it when the news is no longer relevant. 

 

Or you could potentially go all out and create an administrative portal, with PHP/HTML/CSS on a web server like XeduR is talking about to present you (or who ever's posting the news) with a web form, to enter the message and save it to your web server. 

 

You could even setup a Wordpress  server on a web host, use Wordpress to write blog posts and use Wordpress's RSS feed to make multiple posts available.

 

It's all up to your imagination. 

 

Rob


  • pixec likes this

[TOPIC: post.html]
#4

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 926 posts
  • Corona SDK

Thank you for all your fast help on this! Much appreciated!




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: server, news, network