WWW doesn't work on localhost eventhough crossdomain.xml exists

Hi guys!

I want to access data from my WAMP based database on my localhost. Only using the following script gave me an error:

function Start() {
    hs_get = WWW('http://localhost/unity/');
    yield hs_get;
 
    if(hs_get.error) {
    	print("There was an error getting the data: " + hs_get.error);
    } else {
        Debug.log(hs_get.text);
    }
}

There was an error getting the data: Rejected because no crossdomain.xml policy file was found.

So I placed a crossdomain.xml in my localhost. Now if I open the following link: http://localhost/unity/crossdomain.xml I get the crossdomain.xml file. The file contains the following:

<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>

But still Unity gives me the same error :frowning:

There was an error getting the data: Rejected because no crossdomain.xml policy file was found
UnityEngine.MonoBehaviour:print(Object)
$:MoveNext() (at Assets/Avatar/Character/_Character.js:45)

I’ve been searching but cannot get an awnser! Can some one help!?

The crossdomain policy file have to be in the root. So Unity looks for it at this path:

http://localhost/crossdomain.xml

To quote the above link:

...you would need to place a crossdomain.xml file at the root of the 
highscoreprovider.net domain like this:
http://highscoreprovider.net/crossdomain.xml