したがって、これを行う最善の方法は、「ストリーム」テーブルに対して FQL を使用することです。ここから、WHERE 句を追加して、私が求めていることを正確に行うことができます。最も困難な部分は、特定の分野で Facebook が提供するドキュメントがないことです。"タイプ"。
https://developers.facebook.com/docs/reference/api/user/
https://developers.facebook.com/docs/reference/fql/stream/ 必要な権限: 「read_stream」
最初のクエリ「SELECT post_id、actor_id、target_id、message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0」を実行すると、更新の幅広いリストが得られます。ニュースストリーム。
そのため、テスト アカウントでいくつか変更を加えることで、ユーザー アカウントでのアクティビティの変更に一致する「タイプ」を見つけることができました。
仕事と教育はグループ化されています。
つまり、具体的に 1 つのアクティビティを探したい場合は、「タイプ」を上記の ID と同じになるように変更できます。
$query = "SELECT post_id, actor_id, target_id, message, created_time, description, description_tags, type, place FROM stream WHERE type = '62' filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me())";
$response = $this->facebook->api('/fql?q=' . urlencode($query));
応答は次のようになります。
'data' => array(
(int) 0 => array(
'post_id' => '100035395_38758242', //I've changed this post id to be random
'actor_id' => (int) 4242, //I've changed this actor_id to be random
'target_id' => null,
'message' => '',
'created_time' => (int) 1347601178,
'description' => 'Joe Smith updated his work and education on his timeline.',
'description_tags' => array(
(int) 0 => array(
(int) 0 => array(
'id' => (int) 4242, //I've changed this id to be random
'name' => 'Joe Smith',
'offset' => (int) 0,
'length' => (int) 8,
'type' => 'user'
)
)
),
'type' => (int) 305, //<--- Note the type id
'place' => null
),
);
ここで、学歴と職歴を組み合わせることができ、潜在的に他のタイプも組み合わせることができることに注意する必要があります。ここから「post_id」を直接クエリして、関連する詳細情報を取得できます。
$post = $this->facebook->api('/100035395_38758242');
これに対する応答は次のようになります。
array(
'id' => '100035395_38758242',
'from' => array(
'name' => 'Joe Smith',
'id' => '4242'
),
'story' => 'Joe Smith added Harvid University of America to his timeline.',
'story_tags' => array(
(int) 0 => array(
(int) 0 => array(
'id' => '4242',
'name' => 'Joe Smith',
'offset' => (int) 0,
'length' => (int) 8,
'type' => 'user'
)
)
),
'actions' => array(
(int) 0 => array(
'name' => 'Comment',
'link' => 'http://www.facebook.com/3535/posts/345345' //Changed
),
(int) 1 => array(
'name' => 'Like',
'link' => 'http://www.facebook.com/345345/posts/34534' //Changed
)
),
'type' => 'link',
'created_time' => '2012-09-14T05:39:38+0000',
'updated_time' => '2012-09-14T05:39:38+0000',
'comments' => array(
'count' => (int) 0
)
)
別の方法として、ユーザー ID を直接クエリして、「タイプ」に関連するフィールドを取得することもできます。つまり、「仕事」または「教育」です。
$friend = $this->facebook->api('/242?fields=work,name,education,id');
注: X 週間または X か月前のデータが必要な場合は、Facebook へのクエリ内で「created_time」を使用する必要があります。そうしないと、クエリごとに 30 日または 50 投稿に制限されます。