Rejected because no crossdomain.xml policy file was found

I am using Apache server to host my Unity game. I also have a php file on the server to write game data to a database.

I have a crossdomain.xml file at the root of the server which contains the following:

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

I am also running ‘sockpol --all’ on the server.

When I call ‘ret = Security.PrefetchSocketPolicy(“server ip”, 843);’ it returns false and when the hs_post = WWW(gamedata_url) call is made it returns the error ‘Rejected because no crossdomain.xml policy file was found’.

I know the code is correct because when I run it using a local server it writes to the database correctly. It is only when I place the php file on the server and try to access it remotely that it doesn’t work. I have spent many hours trying to resolve this issue without any success.
Any help would be greatly appreciated.

There are a few comments to make.

  1. Firstly, the sockpol application is there to support clients that need to make access to your server using sockets. If you are only using the WWW class then you should not need this application running, and the Unity webplayer will not connect to your server over port 843.
  2. The Security.PrefetchSocketPolicy is not needed if you are using the WWW class (only).
  3. The first time you make a WWW request to a URL different from where the unity3d file comes from Unity will try to read the crossdomain.xml file from your server. You may care to examine your server logs to determine if this file has been requested and returned. It’s possible your server is not configured to serve XML files. (You could also try to fetch the crossdomain.xml directly using a web browser and checking that the server delivers it. Or try using curl to fetch it.)
  4. As jahroy says, the crossdomain.xml must be a pure ascii file, as per the documentation.

Thanks for the swift replies. I have already tried that Jahroy, both UTF-8 and ASCII but no luck. Your advice should be helpful in narrowing down the problem Graham, no that I know sockpol and Security.PrefetchSocketPolicy are not relevant for what I’m trying to achieve. I have previously tried fetching the xml file directly through the browser and that works no problem. I will look through the log files to see if that will shed any light on the problem. I will need to look into whether or not Apache can serve xml files. Perhaps you can suggest a Windows server which will definitely serve the xml file and therefore work with Unity webplayer out of the box?
Thanks again guys, your feedback is much appreciated…,Thanks Jahroy and Graham, I appreciate your swift replies. I have tried encoding the xml file in both UTF-8 and ANSI and neither made any difference unfortunately.
It is good to know that ‘Security.PrefetchSocketPolicy’ is not need for what I’m trying to achieve Graham, could help me narrow down the problem. I have also tried checking if it is delivered directly and it is…I will need to look into configuring Apache to serve XML files. Perhaps you could suggest another Windows server which will definitely work in this way?..
Thanks again guys…