I’m trying to get the number of notifications via
/notifications.json on https://mysite.com
I’ve enabled CORS in the app.yml file (also allowed http://mysite.com on Discourse > Settings > cors origins).
I’m already using other .json to retrieve other information and it works perfectly (
/latest.json, for example).
Here is my code in PHP, I’m just trying to get one of the objects, to see if I can access to any of the information.
$string_notifications = file_get_contents('https://forum.mysite.com/notifications.json'); $json_notifications = json_decode($string_notifications, true); $notifications_total_number = $json_notifications['total_rows_notifications']; echo $notifications_total_number;
But it doesn’t work. It doesn’t retrieve anything.
If I go to https://forum.mysite.com/notifications.json via the browser it works.
Any ideas why is not working? Am I missing something?