Reputation: 79
multiple uid for tagged friend in photos not working. below code is worked for single user only.. i passed the three uid in array after i passed them into foreach and that processed variable passed into the facebook graph api..how to tagged those 3 uid in facebook using graph api ($argstag
). Can anyone help me ... Any help is appericiated.. Thanks in advance
$friends_tag_array[]=array('uid'=>'1472898480','x'=>'40','y'=>'40');
$friends_tag_array[]=array('uid'=>'100002109469765','x'=>'40','y'=>'40');
$friends_tag_array[]=array('uid'=>'561260191','x'=>'40','y'=>'40');
//echo '<pre>'; print_r($jsonfrnd); echo '</pre>'; die();
for($i=0;$i<count($friends_tag_array);$i++)
{
foreach($friends_tag_array as $value)
{
//print_r($value); die();
$friend = $value['uid'];
//$frndId = $friends_tag_array[$i]['uid'];
$argstag = array('to'=>$friend);
$argstag['x'] = '40';
$argstag['y'] = '40';
}
}
try
{
$res = $facebook->api('/'.$json->id.'/tags', 'POST', $argstag);
} catch (FacebookApiException $e) {
Mage::getSingleton('core/session')->addError($post_process_view->render(POST_PROCESS_TEMPLATES,'post_process-error.phtml'));
}
Upvotes: 1
Views: 401
Reputation: 4634
the below code works for me while multiple tagging. hope it helps you as well in debugging your problem
$friends_id = array('1472898480','100002109469765','561260191')
$tags = array();
foreach ($friends_id as $id)
{
$tag = array();
$tag['tag_uid'] = $id;
$tag['x'] = rand() % 100;
$tag['y'] = rand() % 100;
$tags[] = $tag;
}
$argstag = array(
'tags' => $tags
);
$facebook->api("$photoId/tags","POST", $argstag);
Upvotes: 2