'Fetching' file's content over Internet (not download it)

0 favourites
  • 12 posts
From the Asset Store
Fetch Quest
$19.99 USD
Fetch Quest 1 music pack is a collection of 10 in-game music loops.
  • I want to fetch files from the Internet and use them in C2.

    Example:

    A File ~ "file.txt" from "http://example.com/folder/file.txt" and use the file's content under C2

    For an instance:

    A file named "users.txt" containing: "hello, world, test", fetching them from C2 somehow and using the fetched value as string

    Any possible ways?

    (Extra: I'm using Release 212 of C2) Thanks

  • : I'm using Release 212 of C2

    I can't see any reason why anyone would still be using a version from 2.5 years ago. There have been many, many changes to C2 since then. It is not feasible to try and support such an old version.

    Please upgrade to at least the latest stable release (link at bottom of forum) or it's likely that users giving you examples will not work.

    Thanks

  • Ajax: https://www.scirra.com/manual/107/ajax

    BTW, you should consider zenox98 advice.

  • Roger! BTW Thnx

  • helpful for me

  • Any way to get the server's response from C2? (like PHP file 'echoes' something?)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Any way to get the server's response from C2? (like PHP file 'echoes' something?)

    AJAX too.

    If you do a GET/POST to a PHP page like this:

    echo 0;

    You'll have access to that "0" with AJAX.LastData

  • I did it but still triggers the 'On Error' section everytime

    imgur.com/a/f1fY5

    Any help? (Updated C2)

  • I did it but still triggers the 'On Error' section everytime

    http://imgur.com/a/f1fY5

    Any help? (Updated C2)

    1. Are you doing a POST to a GET URL?. Maybe that's your problem. You should see your web server logs.

    2. Use IP instead of localhost

    3. In your php file add this as the first line (after <?php): header('Access-Control-Allow-Origin: *');

    4. Print as debug AJAX.LastData even in the "On any error" event.

  • Maybe attaching a simple .capx might help others to see what you have done and maybe see what needs to be done.

    It's usually the quickest way to get a successful resolution to your problem.

  • Sorry but cant find any possible ways to hook up the capx file... Can you do the same making simple one please?

  • Sorry but cant find any possible ways to hook up the capx file... Can you do the same making simple one please?

    You just need to use one of the many free hosting sites. Just export as a single file, upload to the site, get the 'public' url and post it here for everyone to access. It really is the best way to get effective help.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)