Reputation: 3
I want totag more than one friend. I want to tag about 10 friends top 10 if any body knows ? New Here thats why. Here is code:
$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,
Upvotes: 0
Views: 1487
Reputation: 31870
Here's a great example of how to tag a person in a photo:
https://developers.facebook.com/blog/post/509/
Here's how to get 10 friends via FQL:
SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 10
Here's how to do it with the Graph API:
/me/friends?limit=10&fields=id
Upvotes: 1