当前位置: 动力学知识库 > 问答 > 编程问答 >

Is there any method to get the details of friends added in the last 10 or 30 days in facebook

问题描述:

Is there any method to get the details of friends added in the last 10 or 30 days in facebook ?

网友答案:

No; you'd need to have been polling for friend lists and comparing the delta

网友答案:
finally I got the answer!
$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;
Try this in your facebook applications.thanks.
分享给朋友:
您可能感兴趣的文章:
随机阅读: