2012-03-01 3 views

答えて

3

私はFQL通知を使うべきだと思います。
通知は実際には過去7日間に限られています。


は、この文字列で検索してください:

SELECT created_time, sender_id, title_html, href, object_type 
FROM notification 
WHERE recipient_id=me() and object_type = 'friend' 

更新:

別のアプローチ、少しトリッキー。
あなたのstreamに古い友情を見ていることができる必要があります:あなたは文章are now friendsまたはis now friendsを含むすべての行は、(文章の単語が(顧客から依存することに注意してもらう。このように

SELECT created_time, description FROM stream WHERE source_id = me() 
and (strpos(lower(description),'are now friends') > 0 
    or strpos(lower(description),'is now friends') > 0) 
limit 50 

)ロケール?設定)。だから、すべての行と一致します:

  • XとYが
  • Xは、XとYとは友人である友人です...

ストリームテーブルの各クエリが制限されています過去30日間または50件のうちのいずれか大きいほうを選択できますが、FQL演算子(<または>など)とともにcreated_timeなどの時間固有のフィールドを使用すると、はるかに広い範囲のポストを取得できます。 https://developers.facebook.com/docs/reference/fql/stream/

アップデート2:あなたは私の知る限り、あなたが同じ(つまり、あなたが過去7日間に制限されている)FQLの限界を知っている、唯一のグラフAPIを使用したい場合は

https://graph.facebook.com/me/notifications?include_read=1

しかし、この場合、あなたはobject_typeのためにフィルタリングすることはできませんし、我々は、任意のアイデアをグラフAPIを使用しているすべてのtitle containings "accepted your friend request"

+0

を見つけなければなりませんか? – PrateekSaluja

+0

https://graph.facebook.com/me/notifications?include_read=1を試したことがありますか? – freedev

0
try this.. 
$count=0; 
$fbid=xxxxx; 
$onemonthbefore = strtotime(date("Y-m-d",strtotime("-1 Months"))); 
$ss=urlencode("SELECT created_time,description_tags,source_id,description FROM  stream WHERE source_id = xxxxxx and (strpos(lower(description),'are now friends') > 0 or strpos(lower(description),'is now friends') > 0) limit 100"); 
$sql="https://graph.facebook.com/fql?q=$ss&access_token=xxxxxxxxx&format=json& date_format=U"; 
$new =file_get_contents($sql); 
$new =json_decode($new); 
foreach ($new->data as $data) 
{ 
    if($data->created_time > $onemonthbefore) 
    { 
    foreach ($data->description_tags as $tags) 
    { 

    foreach ($tags as $friend) 
    { 
    if($friend->id !=$fbid) 
     { 
     $count++; 
     } 
    } 
} 
} 
} 
echo "new friends=".$count; 
関連する問題