Stream.getComments

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

This method returns all comments associated with a post in a user's stream. This method returns comments only if the user who owns the post (that is, the user published the post to his or her profile) has authorized your application.

This method is a wrapper for comment FQL table, indexed by post_id rather than xid.

Parameters

RequiredNameTypeDescription
required post_id string The ID for the post for which you're retrieving the comments.

Example Requests

$facebook->api_client->stream_getComments(post_id)


PHP Example

$comment = $facebook->api_client->stream_getComments($post_id); echo "Comment ID ".$comment['id'] echo "Comment Text ".$comment['text'] echo "ID if the user who write the comment ".$comment['fromid'] echo "Time the Comment has been posted (Unix Stamp) ".$comment['time'];

Response

This method returns an array of comments, where each comment contains the fields from the comment (FQL) table.

FQL Equivalent

FQL queries take the form: SELECT <fields> FROM <table> WHERE <conditions>

This function is similar to doing the following FQL query, with the appropriate parameters specified (note you can SELECT any fields from the stream (FQL) table):

SELECT post_id, fromid, time, text FROM comment WHERE post_id=<post_id>

Notes

You can call this method using a session secret, and not the application secret (for example, for a Facebook Connect site or desktop application).

See Also