Jump to content

Phaser + CocoonJS - PHP Services problem


Recommended Posts

Hi everyone!


I'm in the final phase from my game, fixing bugs to work like a charm on mobile, but i'm having a lot of problems with cocoonjs.


A co-worker told me that Cocoonjs doesn't support PHP. I was working with an intermediate PHP file to call to an external URL (From a service) that returns information, but it only returns the file content itself.


Now i'm trying to retrieve information from the service but i'm having cross-domain issues.


Someone actually has achieved this? 


Any information would be appreciated.


Link to comment
Share on other sites

@programlocura: While it is true CocoonJS doesn't support PHP (it is just a browser itself), I don't think that is particularly the issue here. If you are getting cross-domain issues, it is most likely because you are breaking a security rule about accessing resources outside of your domain.


If you want a CocoonJS app to have access to data provided from a PHP script, that file needs to be publicly accessible. Just like any other browser, CocoonJS can make a XHR object and GET or POST data. What you might need to do is have the PHP script call this external service either before, as part of some type of regular polling, or right after as a result of an incoming connection just like you would for a web page.


If you are getting the file contents of a PHP script, it is probably because the server is not running it, but is sending it as plain text instead. That's not a problem with Phaser or CocoonJS but probably with the server settings themselves.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...