I just started game development. And I have a mySQL database that is storing all my highscores. I am hosting my game on www.newgrounds.com ; however, when I go to load the high scores off the site, it doesn’t load, which I am guessing means I did not properly whitelist them. (Since I can load the highscores in my development space, Unity)
Apparently their file hosting is done on ungrounded.net , so I tried this
< ?php
//Insert the domain your game is hosted on into the array
$cors_whitelist = [
‘zhttp://uploads.ungrounded.net/’,
‘uploads.ungrounded. net’,
‘zhttps://www.newgrounds.com’,
‘ungrounded. net’,
‘www.newgrounds. com’,
‘www.ungrounded. net’
];
if (in_array($_SERVER[‘HTTP_ORIGIN’], $cors_whitelist))
{
header('Access-Control-Allow-Origin: ’ . $_SERVER[‘HTTP_ORIGIN’]);
}
//rest of code follows
Note: spaces are added before .net and .com or z at beginning because new users arent allowed to put more than two links I guess ?
However, none of these domains give access to my game on the online host. If anybody has any ideas/pointers would be very appreciated.
Cheers