使用fql标记照片中的前10位朋友

时间:2012-01-14 13:00:26

标签: facebook facebook-graph-api facebook-fql tagging

我想要不止一个朋友。 我想标记10个朋友前10名 如果有人知道吗? 新的这就是为什么。 这是代码:

$user = $facebook->getUser();
'$user_profile = $facebook->api('/me');

$coded = $_REQUEST['code'];

$access_token = $facebook->getAccessToken();
$name = "".$user_profile['name']."";
$fbid = "".$user_profile['id']."";


$fql = 'https://graph.facebook.com/fql?q=SELECT+uid2+FROM+friend+WHERE+uid1='.$fbid.'+ORDER+BY+rand()+LIMIT+1&access_token='.$access_token.'';
 $fqlresult = file_get_contents($fql); 
   $f = json_decode($fqlresult, true);

 $friends = $f['data']['0']['uid2'];

 $fql2 = 'https://graph.facebook.com/'.$friends.'';
  $fqlresult2 = file_get_contents($fql2); 
 $f2 = json_decode($fqlresult2, true);

 $friend = $f2['name'];  



 $file='img/'.$fbid.'.jpg'; //Example image file
 $data = array(array('tag_uid' => $friends, 'x' => rand() % 100, 'y' => rand() % 100 ));
 $data = json_encode($data);
//, 'tags' => $data,

1 个答案:

答案 0 :(得分:1)

以下是如何在照片中标记某人的一个很好的示例:

https://developers.facebook.com/blog/post/509/

以下是如何通过FQL获得10位朋友: SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 10

以下是使用Graph API的方法: /me/friends?limit=10&fields=id

相关问题