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(“https://www.pepworks.com/works.php ”, function (err, data) {
alert(data);
});
data is always ‘nulll’ and alert happens 2x!

Look at the console for the error.

You need to set the remote server ‘pepworks.com’ 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 pepworks.com?

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 pepworks.com, 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 pepworks.com

Yes, I export the build from playcanvas and upload the full zip on pepworks.com.
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 pepworks.com?

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

Works fine as shown in this project: https://playcanvas.com/editor/scene/752760

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: