2012-01-14 111 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

相關問題