Talk:Stream.getComments

From Facebook Developer Wiki

Jump to: navigation, search

When no user is logged into Facebook, the PHP Client of this API call returns nothing, when a user logged in an array is correctly returned $fbarray=$facebook->api_client->stream_getComments($fbid['fbpost']);

As above, you have to have a valid session key for a user that has visibility to this post in order to get results back. It looks like "a user that has visibility" is any friend of that user who would see that post in his or her stream.

[edit] Return Values

This seems to return an empty string if there is no data to return. If there is data then it returns an array. Steve --892645194 03:12, 15 October 2009 (PDT)

Hi Steve, can you provide us with a repro case? On our end we get back {} or an XML header. You can file a bug with the repro steps if you'd like. Thanks, Pete -- 563683308 18:43, 16 October 2009 (PDT)
Sure. This is using my developer account ID (100000384338372). In the API test console if I use the Facebook PHP Client Response format and pass:

$facebook->api_client->stream_getComments('100000384338372_100685913287553');

The portion of the page that shows the return value shows " <empty string> ". If I make that call in my code like this:

$fbcomments=$fbclient->stream_getComments($comdata_row->fb_post_id); var_dump($fbcomments);

Then if I've no comments then the var_dump returns: string(0) ""

If I do have comments then I get:

array(1) { [0]=> array(4) { ["fromid"]=> string(15) "100000384338372" ["time"]=> string(10) "1255778949" ["text"]=> string(49) "I'm going to test this to see if I get a comment!" ["id"]=> string(36) "100000384338372_100347103321434_1938" } }

Which is exactly what I get if I do the call for that post_id on the API test page:

Steve --892645194 14:21, 18 October 2009 (PDT)

reference