i want to have facebook comments + my own website comments on my site.
The thing is when showing posts i want to show a comment count next to every single one(so my comm
Try this:
Place the URL separated by commas, If you wanna fetch multiple calls using the graph API :
https://graph.facebook.com/comments/?ids=http://URL_1,http://URL_2,http://URL_n
I think for your use case FQL will suit the best : https://developers.facebook.com/docs/reference/fql/comment/ . On the side note, if you wanna do multiple http calls using the graph API , its always good to do "Batch calls" as documented in the graph API documentation.
Here are some examples of ways you could do this:
You can build your a JSON array of queries and then use the Rest API fql.multiquery method to run them. For example, this would be your JSON array of queries:
{
'query1': "select post_fbid from comment where object_id in (select comments_fbid from link_stat where url ='http://developers.facebook.com/docs/reference/fql/comment/')",
'query2': "select post_fbid from comment where object_id in (select comments_fbid from link_stat where url ='http://developers.facebook.com/docs/reference/fql/album/')"
}
Run this using the test console on the fql.multiquery page and you'll be able to see a response containing a list of post_fbids which you could then count using your favored counting method.
Here you can use a Batch Request to run all of your queries at once. So for a PHP Example you'd be doing:
curl \
–F ‘access_token=…’ \
-F ‘batch=[ \
{“method”: ”GET”, “relative_url”: ”comments/?ids={PAGE_URL1}”}, \
{“method”: ”GET”, “relative_url”: ”comments/?ids={PAGE_URL2}”}, \
{“method”: ”GET”, “relative_url”: ”comments/?ids={PAGE_URL3}”} \
]’\
https://graph.facebook.com
For as many pages as you want.
Note: Given that both APIs do have a bit of a delay before you'll get a response, obviously it's recommended to run them asynchronously so that you aren't causing your site load to delay significantly.