*urgent* Download (and parse) file from URL.

Get help using Construct 2

Post » Wed Feb 12, 2014 7:12 am

Hello, guys. I have decided to attempt to make a dynamic news application in one or two days as a project for my school, which would download a file from dropbox (through the public link) containing information about articles and links to them/any images that are used.

The problem i am facing, however, is getting the files to download seamlessly (without alerting the user, at least no prompts) and then parsing them.

So, my questions are:

1.) Is there a way one can download a file from a URL regardless what platform the export is done on (android, website) and (later) parse it as a text string, line by line, without modifying the parameters of the hosting server (e.g. i have no access to modifying those http headers on dropbox)?

2.) How would one parse such a file in C2, by reading it line by line (is there a way to retrieve the line count of a string and then do a loop from 1 to stringcount, then retrieving the text for each line of the file, for it to be interpreted)?
B
10
S
1
Posts: 163
Reputation: 1,436

Post » Wed Feb 12, 2014 7:34 am

If you host the information yourself on a site, and are able to put it in a mysql database, you could easily fetch its information through ajax.

You could make a ittle php web app to serve a content manager/adder for the news, and a application in cs2 to retrieve the information.lennaert2014-02-12 07:34:42
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Wed Feb 12, 2014 7:47 am

The goal is to use Dropbox as the main storage place for the files (i doubt that i have time for anything else). Is there a way to do exactly what i described, without having to resort to workarounds so soon?
B
10
S
1
Posts: 163
Reputation: 1,436

Post » Wed Feb 12, 2014 9:41 am

It appears that i have gotten the AJAX functionality to work (at least it seems to function when i test it through chrome with C2's preview function), however it appears that AJAX does not support UTF-8 text encoding. Is there a way around this, such as using one of the compress plugins (deflate, base32) to compress the text and afterwards decompress it? Would this work? What else is there to do?
B
10
S
1
Posts: 163
Reputation: 1,436

Post » Wed Feb 12, 2014 10:09 am

What about parsing xml ?
B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Wed Feb 12, 2014 10:24 am

I want to have my own custom syntax, having xml layered on top of it seems like a hassle. Also, i think i fixed it - Notepad++ has another encoding set by default, and although it displays UTF-8 characters just fine (somehow), this causes problems with AJAX. Holy hell, i actually managed to do this.
B
10
S
1
Posts: 163
Reputation: 1,436


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 38 guests