Talking to PHP broken?


I try to get data from a php inside playcanvas - but the http seems to be broken!?
Any workaround on this?

With a simple ‘echo’ php:
pc.http.get(“ ”, function (err, data) {
data is always ‘nulll’ and alert happens 2x!


Look at the console for the error.

You need to set the remote server ‘’ to allow for cross domain access.


Unfortunately it is not working, even if I launch the playcanvas project from the same server…
It took me 5 seconds in Unity to make it working and now I am trying for 4 hours to read
data from the WWW into playcanvas… I don’t think this is, how it should work (not)


How are you launching from the same server? The PlayCanvas app can’t be in an iframe that has a different domain.

Are you exporting the PlayCanvas project and uploading to


Yes, is that still a problem?


Bear in mind that you were running Unity on desktop, not from a domain so CORS doesn’t apply. If you uploaded the Unity build to a different domain to, then it will fail due to CORS


Yes to which bit? Iframe with a different domain or exporting the project and uploading the build to


Yes, I export the build from playcanvas and upload the full zip on
Looking at the playcanvas files it should be clear to the PHP it’s on the same server!?


That should work. Can you post a link to the uploaded build on


I’ve created a test PHP server on 000 webhost and modified the htcaccess to allow CORS.

Works fine as shown in this project:


How did you modified the htcaccess?


In my case, there was already a .htcaccess file to edit. If there isn’t one, you can create one. It’s just a text file. 000webhost had a file editor in the browser that made it easier.


YEAH! Cool, have it working finally! BIG thanks, you are a rockstar, eh, yaustar :star_struck: