开发者

App connected to Facebook. Whats next?

I'm confused. I wrote a PHP program that connects my application with Facebook. If the user granted permissions, I store the facebook UID into my database.

Now, after the user returns to my application and logged in I can retrieve his facebook UID from the database.

Question: how can I use PHP to for instance, get the number of friend requests, messages in the inbox, etc.?

If I use something like th开发者_运维问答is:

        require 'facebook/facebook.php';
        $facebook = new Facebook($this->FACEBOOK_PARAMS);

        $fql = "SELECT notification_id, sender_id, title_html, body_html, href FROM notification WHERE recipient_id="  . Zend_Auth::getInstance()->getIdentity()->fb_uid .
               " AND is_unread = 1 AND is_hidden = 0";
        $param  =   array(
         'method'    => 'fql.query',
         'query'     => $fql,
         'callback'  => ''
        );
        $fqlResult   =   $facebook->api($param);
        $fqlResult = $fqlResult[0]; // list of permissions

I get the error message: "Requires user session".

Bye & Thanks


You need the Graph API: http://developers.facebook.com/docs/reference/api/ and you need to authenticate using http://developers.facebook.com/docs/authentication/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜