0

I recently included the facebook comments widget on my site, and now I would like to, on another page tell how many comments each post on my site has. My code looks like this:

$facebook = new Facebook(MY_API_KEY,MY_SECRET_KEY);
$result = $facebook->api(array(
    'query' => 'SELECT text FROM comment WHERE xid=3', 
    'method' => 'fql.query'));
print_r($result);

If I run that same FQL query on this page: http://developers.facebook.com/docs/reference/rest/fql.query/ it works, but when run on my site it returns an empty array.

Thanks in advance!

1
  • I have the same issue. Anybody found a solution? Commented Jan 15, 2011 at 16:42

1 Answer 1

1

You're mixing front end documentation with back end implementation. The link you posted is more for implementation in javascript.

You should be creating and instance of Facebook like this:

$facebook = new Facebook(array('appId'=> MY_API_KEY, 'secret'=> MY_SECRET_KEY));

That may be your problem, you may not be getting and authenticated instance of Facebook. The constructor function only takes 1 parameter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.