How do I call a text file from google drive

Get help using Construct 2

Post » Fri Apr 20, 2018 5:40 pm

Hello to everyone , I have an app that give predictions for football games on google play store but google inform me that i have to unpublish it because my app request a webpage. note that this app made with adobe flash pro.
So now i have to use construct 2 to call a text file from google drive but i dont know how.
I trying the past 2 days using ajax but i didnt get it?
Any ideas?
B
9
S
1
Posts: 29
Reputation: 489

Post » Sat Apr 21, 2018 12:38 pm

savvito123 wrote:Hello to everyone , I have an app that give predictions for football games on google play store but google inform me that i have to unpublish it because my app request a webpage. note that this app made with adobe flash pro.
So now i have to use construct 2 to call a text file from google drive but i dont know how.
I trying the past 2 days using ajax but i didnt get it?
Any ideas?

You want ONLY the text, right? So, you need to upload at your server or something and then when you copy the URL/link, you must make sure that the extension(.txt) is there or it will request a webpage instead of the text.

EXAMPLE
Image

HIGHER QUALITY EXAMPLE IMAGE
https://image.ibb.co/gbncpH/THE_25.png


UPDATE: Umm... I don't think you request the text file from Google Drive. Try to search for hoster service or just get a free hosting service like https://www.5gbfree.com/ or something.
B
24
S
9
G
4
Posts: 97
Reputation: 3,958

Post » Sat Apr 21, 2018 4:11 pm

I tried it already but didnt work.
The pathfind is username.5gbfree.com/text.txt
Also i try with 000webhosting but the same result.
I read the manual and i notice

If you want AJAX requests to your server to work from any domain, or in preview, you can configure it to send the following HTTP header:

Access-Control-Allow-Origin: *

How can i configure that?
B
9
S
1
Posts: 29
Reputation: 489

Post » Sun Apr 22, 2018 6:22 am

savvito123 wrote:I tried it already but didnt work.
The pathfind is username.5gbfree.com/text.txt
Also i try with 000webhosting but the same result.
I read the manual and i notice

If you want AJAX requests to your server to work from any domain, or in preview, you can configure it to send the following HTTP header:

Access-Control-Allow-Origin: *

How can i configure that?


Oh, yeah. I forgot to tell you. It will not work on PC. It work on mobile though. Try it. And I don't know how to configure the Access-Control-Allow-Origin
B
24
S
9
G
4
Posts: 97
Reputation: 3,958

Post » Sun Apr 22, 2018 7:57 am

HTTP headers are configured on the server side, where the file is hosted - in your case, Google Drive.

The control is specifically there to prevent outside websites or apps (your game) from directly accessing files on the server. It is pretty much on by default for all servers, because the owners of those servers don't want people abusing their resources.

If you are the owner/admin of your own server, you can set that HTTP header to allow cross domain access in your server configuration.

Basically, if you want your app to access data online, a free file hosting service probably isn't going to cut it. You might want to look into setting up your own server, or use a service like backendless, firebase, or parse.
Mistakes were made.
B
62
S
30
G
134
Posts: 1,974
Reputation: 75,475

Post » Sun Apr 22, 2018 10:16 am

Well , i add this line

<?php
header('Access-Control-Allow-Origin: *');
?>

to 5gbfree and 000webhosting index.html but still the same.

When i try the backendless it seems to work.

Thank you @oosyrag for another answer!
B
9
S
1
Posts: 29
Reputation: 489


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest