Reading a .txt file on a webpage (URL)
Monkey Forums/Monkey Programming/Reading a .txt file on a webpage (URL)
| ||
Hey all I have been away from monkey for quite some time and I can see lots of new stuff (per pixel stuff YES!)but I have a simply question. I have a .txt file on a web server what is easiet way of getting that loaded into my monkey app as a string? on andriod and html5? I have done a search I can see all this new async stuff etc but looking at the example it seems awfully complicated for just reading a text file. And if I could write to the file that's a bonus. |
| ||
I would also like to know this! |
| ||
You could use a web service. I have a web service written in asp.net running on our web server in London and using the new TCPStream class I am able to call the web service with no problem. So technically reading and writing to a text file would be really simple, just use a web service to process everything on the server. If you need an example, let me know and I will see if I can knock something up for you. |
| ||
I do exactly this with the MNet module. It has a http-get function. But it is only working on Android not on Html5 |
| ||
agreed - same here except im using PHP code. Do a http call to the .php on the web server and it returns whet you need. I use it also todo sql lookups etc... StuC |
| ||
If he want to read a *.txt, which is already on the server, he can call it directly from the MNet http-function without need of writing any PHP-code. Just this: [monkeycode]result$ = ht.Get( "http//www.mypage.com/anyfolder/anything.txt", 3000 )[/monkeycode] |
| ||
If you need an example, let me know and I will see if I can knock something up for you. I would love an example if you have time, I have been wondering how to read/write txt files on a server for a long time now. Is it possible to create new txt files as well? |
| ||
Yes, no problem creating text files if you use a web service. I do not use PHP and can only give you an example using C# running on a Windows server. What platform is your Web Server running on? |