Retrieving Comment Count From Fb:comments Widget (facebook)
I've tried using both the JavaScript and PHP SDKs, but I can't solve this simple problem. My FQL looks like: SELECT count FROM comments_info WHERE xid='...' When I attempt the req
Solution 1:
Oops... bit of facepalm. "No valid app_id" doesn't mean my application id is invalid — it means I need to specify an app_id in my FQL query, as indicated on the documentation page.
Here's a working PHP example for getting the comment count:
require_once('facebook.php');
$facebook = new Facebook(array(
'appId' => '[...]',
'secret' => '[...]'
));
try {
$result = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT count FROM comments_info WHERE app_id='.$facebook->getAppId().' AND xid="'.[...].'"'
));
} catch (FacebookApiException $e) {
error_log($e);
}
Post a Comment for "Retrieving Comment Count From Fb:comments Widget (facebook)"