PHP function to get Facebook status?

前端 未结 10 1822
甜味超标
甜味超标 2020-12-08 12:30

I\'m looking for a good, simple PHP function to get my latest Facebook status updates. Anyone know of one?

Thanks!

EDIT: I\'ve added a half

10条回答
  •  一个人的身影
    2020-12-08 13:04

    This is an incomplete answer, but this is what I've gotten so far:

    First: add the developer application on FB. Then create a new application. Call it whatever you want.

    Second: Download the PHP client. Dump it somewhere on your webhost, i.e. /facebook/

    Third: Copy the following beginner code to get yourself started into a php file:

     api_client->fql_query("SELECT status FROM user WHERE uid = YOURIDNUMBER");
     // OR --- they both get the same data
     $result = $facebook->api_client->users_getInfo(YOURIDNUMBER,'status');
     print_r($result);
     echo "
    Debug:" . print_r($facebook,true) . "
    "; // debug info ?>

    Other info:

    • You must be logged in and have the application added. OR you give the application offline_access permissions and have the aapplication added.
    • You can add offline_access by typing in the following url: http://www.facebook.com/authorize.php?api_key=YOUR_API_KEY&v=1.0&ext_perm=offline_access
    • more info on permissions found here: http://wiki.developers.facebook.com/index.php/Extended_permissions
    • I'm at a stopping point: anything my program calls the fql query or users_getInfo, my page stops executing the php? I'm guessing there are a limited amount of calls for new applications? I've never done any FB development so I'm completely new to it. Maybe make the call and save your recent status (or most recent statuses) in your own DB to prevent excessive calls to the API?

    I hope this helps someone get started!

    EDIT: It seems that FB won't let you access someones status, even if the offline_access is on, unless you are that person or their friend (depending on their privacy settings).

    I did however, finally manage to find the RSS feed in the new profile version: http://www.new.facebook.com/minifeed.php?filter=11

提交回复
热议问题