Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not receiving realtime updates at all from Facebook

Tags:

I've setup my server to receive realtime updates from facebook, I've gone through the authentication to get the token etc, registered the callback url... and I've not received a single notice since the authentication GET request.

When I GET graph.facebook.com/APP-ID/subscriptions I receive...

data: [ {   object: "user",   callback_url: "REDACTED-VAID-URL",   fields: [     "activities",     "books",     "checkins",     "events",     "feed",     "friends",     "interests",     "likes",     "location",     "movies",     "music",     "television"   ],   active: true } ] 

So as far as I can tell the realtime notification is setup correctly. When I send my own POST to the callback URL the server emails me the POST details every time, but I've never received this after a facebook update, so I'm pretty sure it's just not hitting the URL. I've several users authenticated with the app, we've all tried various things on facebook to try and trigger it (status update, post, like etc). I can pull in their feed etc from the normal rest API.

There must be something I'm just missing here, what else do I need to do to get this to work?!

like image 870
Malcolm Christie Avatar asked Jul 30 '12 15:07

Malcolm Christie


1 Answers

For those using PHP...

Facebook's realtime POST data won't come in or be recognizable via the normal $_POST array in PHP. You can use the following to get the raw JSON making up the request to your server:

$json = file_get_contents("php://input"); 

You can then convert this into an array simply by:

$realtime = json_decode($json, true); 

It's too bad, however, that the data Facebook gives you in these requests is mostly worthless :-/

like image 102
Art Geigel Avatar answered Sep 25 '22 12:09

Art Geigel