User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: GET Object in HTML5 not working

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    GlitchyDust's Avatar
    Join Date
    Jan 2019
    Location
    Canada
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation GET Object in HTML5 not working

    Hello everyone! Iíll keep it quick.

    TLR : The Get Object donít GET data from the web and it seem that it can POST. It always return timeouts.

    Intro:
    When we go to the Object Manager in CF2.5, it says that the GET Object will work in HTML5, so I jumped on it and try it myself. I built a MYSQL Database and 2 PHP code. 1 PHP code is for Updating a value +1 in the Database. The other PHP code is to get this number.

    What I did:
    01 - I programmed the application as the player can press Enter. This condition will add +1 to the Database.
    Once this is done. The application will GET the value of the Database and show it on screen. Pretty basic. Nothing more.
    **Note that this is working fine on Windows.**

    02 Ė Being a bit hyped about it I tried to upload it on Newgrounds as a HTML5 game and PREVIEWED it.
    As soon as I tried. My timeout condition will pop, and the text shown was that the GET action was timed-out.
    weirdly enough. When I tried again in my windows app. The value has gone by +10 or +20.
    It seems that the Post value worked but the application didnít get anything.


    What I tested:
    01 Ė In the GET Object proprieties, there is a way to ďgetĒ information, I donít know the name of those but Iíve tried the 3 of them and didnít worked on Newgrounds.
    02 Ė I simplified the code only to GET information from a web page and didnít work either.

    Father this two test it seems that the application didnít POST anymore. Weird.

    03 Ė I changed an alterable string in the application every time the GET object did something. And the text didnít change so anything Iíve programmed wasnít supported in HTML5 weirdly.

    And yes, father this, the game STILL worked on Windows just fine!


    It would be appreciated to help me a bit with this.

  2. #2
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,593
    Mentioned
    268 Post(s)
    Tagged
    4 Thread(s)
    This seems to be related to CORS.

    and please post a small link where this tst can run but in development mode and not single sources for me to check.
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  3. #3
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Fernando, did you see my post from yesterday? I have an issue with GET as well. It may be bugged.

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    GlitchyDust's Avatar
    Join Date
    Jan 2019
    Location
    Canada
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright,

    There is the HTML application hosted in DEV BUILD:

    https://circumscriptive-bal.000webhostapp.com/
    [Note that when you press enter, it will show the number GOT by the php site]

    There is the PHP GET site:
    https://circumscriptive-bal.000webho...m/getenter.php

    There is the actual MFA / BUILD in a ZIP files:
    https://gofile.io/d/X8k3TQ

    I made this app only for testing purposes so it can be exploited and stuff it's more like an example build for myself.

  5. #5
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,593
    Mentioned
    268 Post(s)
    Tagged
    4 Thread(s)
    https://circumscriptive-bal.000webhostapp.com/
    [Note that when you press enter, it will show the number GOT by the php site]
    oh I need this application made as development and not as single file for me to debug and test
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    GlitchyDust's Avatar
    Join Date
    Jan 2019
    Location
    Canada
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Fernando View Post
    oh I need this application made as development and not as single file for me to debug and test
    Yes, It is in the ".zip" file under the "Build" folder.

    https://gofile.io/d/X8k3TQ

  7. #7
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,593
    Mentioned
    268 Post(s)
    Tagged
    4 Thread(s)
    Oh, i believe there is a confusion about what is CORS


    https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

    I can not test your mfa build in localhost and testing a GET since it will throw me a CORS error like this one

    Access to XMLHttpRequest at 'https://circumscriptive-bal.000webhostapp.com/postenter.php' from origin 'http://localhost:21700' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.


    because GET will only work from the server.
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  8. #8
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    GlitchyDust's Avatar
    Join Date
    Jan 2019
    Location
    Canada
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks.

    I read a bit about CORS. I really don't know anything about CORS yet. So it's really difficult for me to understand that the GET function will only work from the server. What does that really mean?

    If it works on my own computer and doesn't work on the Newgrounds server I don't really see the origin of the problem here?

    I see that in the error you mention it came from the server name that is not authorized in my PHP script.
    $mysql_servername = "localhost";
    does that mean I need to change the name for the true server name to be working?

    Do you have any hypothesis on the solution other than that? because I don't really know another solution for now since I'm not used to CORS.

    -----------------------------------------------------------------------------------------------------------------------

    EDIT:

    I use 000webhost and my SQL database hostname is not shown. It sais only "Localhost".

    2020-05-06 18_42_37-Window.png

    I then Allowed every origin in my PHP file by adding this line

    header('Access-Control-Allow-Origin: *');

    and it returns me this warning:

    Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd5/534/13581534/public_html/getenter.php:1) in /storage/ssd5/534/13581534/public_html/getenter.php on line 13

    -----------------------------------------------------------------------------------------------------------------------

    EDIT 02 :

    I found my solution! I allowed everything and put ob_start(); to buffer the header before getting any output in my PHP code! Here's the code:



    //THIS IS USED TO TELL THE OUTPUT TO BE WORKING ONLY AFTER THE HEADER
    ob_start();
    //THIS HEADER IS TO ALLOW EVERY ORIGIN WEBSITE TO COME INTO THE PHP.
    header("Access-Control-Allow-Origin: *");

  9. #9
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,593
    Mentioned
    268 Post(s)
    Tagged
    4 Thread(s)
    mm you do this for testing (LOCAL-TO-SERVER) but not sure is good for live, keep reading about CORS the link i give will clarify this to you as other links available as well.

    Implement correctly CORS is very important to avoid security leaks in your development.
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  10. #10
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    GlitchyDust's Avatar
    Join Date
    Jan 2019
    Location
    Canada
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I should put only the LINK from where the POST come from right?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Get Object no longer working (HTML5 Export)
    By mirrorman in forum Released Extensions
    Replies: 1
    Last Post: 30th August 2019, 07:41 AM
  2. Does anyone have the Newgrounds API Working with HTML5?
    By redpandagames in forum HTML5 Export Module 2.5
    Replies: 0
    Last Post: 28th June 2016, 09:05 AM
  3. HTML5 video object not working on iPads
    By MTCMusic in forum HTML5 Export Module 2.5
    Replies: 2
    Last Post: 21st September 2015, 11:41 PM
  4. change color of active object is not working in html5
    By brett in forum HTML5 Export Module 2.5
    Replies: 9
    Last Post: 12th August 2015, 08:26 AM
  5. Hi-score object in HTML5 not working
    By cmpessoa in forum HTML5 Export Module 2.5
    Replies: 13
    Last Post: 7th April 2015, 03:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •