2012-01-14 63 views
0

我想要多个朋友。 我想标记约10位朋友顶部10 如果有任何机构知道? 新这里这就是为什么。 这里是代码:使用fql标记照片中的前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, 
+0

你得到什么错误? – DMCS 2012-01-14 15:55:02

+0

其唯一标记一个朋友... – 2012-01-15 04:18:22

回答

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

+0

https://graph.facebook.com/fql?q=SELECT+uid2+FROM+friend+WHERE+uid1=me()+LIMIT+1&access_token='.$access_token。'改变仍然没有工作 – 2012-01-15 04:43:42

+0

限制1与限制10 – DMCS 2012-01-15 07:58:03

+0

仍然没有得到请你会解释一点...? – 2012-01-16 06:22:44

相关问题