0

Do any one know how to fetch activity feed of an user who is associated with an app id ?

I am able to fetch the list of users who are associated with an app id by using this code

<?php 
    require "facebook.php";
    $facebook = new Facebook(array(
        'appId'  => '',
        'secret' => '',
    )); 
    $user = $facebook->getUser();
    if ($user) {
      try {
            $result = $facebook->api(array(
            "method"    => "fql.query",
            "query"     => "SELECT uid, name, pic_square, activities FROM user
            WHERE uid IN (SELECT uid1 FROM friend WHERE uid2 = me()) and  is_app_user"
        ));
    echo "<pre>"; 
    print_r($result);
?>

Output

Array
(
    [0] => Array
        (
            [uid] => 14529121124
            [name] => Saurabh
            [pic_square] => http://profile.ak.fbcdn.net/hprofile-ak-ash4/187195_1452918224_6692287_q.jpg
            [activities] => 
        )

    [1] => Array
        (
            [uid] => 100000565666371
            [name] => Abhijeet
            [pic_square] => http://profile.ak.fbcdn.net/hprofile-ak-prn1/157718_100000289210371_1409561577_q.jpg
            [activities] => 
        )

)


Now i just want to fetch activity feed of these 2 users (User Id: 14529121124 , 100000565666371) individually who are associated with this (54975723243503) app_id.

4

2 に答える 2

2

グラフAPIを使用する:https ://developers.facebook.com/docs/reference/api/user/

そのページで「フィード」を検索する

于 2013-01-15T13:17:32.890 に答える
1

You need to query the FQL stream table or the Graph API feed object:

Since you're working with FQL, I'll give an example using FQL. I did some quick testing, and the stream table doesn't allow you to use the IN keyword to select streams from multiple sources, so you'll need to make two separate calls, first to get the user_ids, second to get the stream.

Try this:

$queries = array();
$i = 0;
foreach ($result as $item) {
   $queries['user_stream'.$i] =>
     "SELECT source_id, created_time, message, attachment FROM stream 
        WHERE source_id = " . $item['uid'];
   $i++;
}

$result2 = $facebook->api(array(
        "method"    => "fql.multiquery",
        "queries"     => json_encode($queries)
         ));
于 2013-01-15T14:23:25.633 に答える