I tried:
$args = array(
'access_token' => $access_token,
'id' => $uid
);
$url = "https://graph.facebook.com/{$idPhoto}/tags";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$data = curl_exec($ch);
It has returned me:
{"error":{"type":"QueryParseException","message":"Unknown path components: \/tags"}}
It does not seem possible because its not in the Facebook documentation:
http://developers.facebook.com/docs/api#publishing
Can someone confirm me that it's not possible to tag a user in a recently uploaded photo?
Uploading image and tagging multiple people in one step using PHP Facebook Graph API:
$args = array(
'message' => 'Message',
'image' => '@' . realpath($path_to_image),
'tags' => array(
array(
'tag_uid'=> $friend1_uid,
'x' => $x1,
'y' => $y1,
),
array(
'tag_uid' => $friend2_uid,
'x' => $x2,
'y' => $y2,
),/*...*/
),
);
$data = $facebook->api('/me/photos', 'post', $args);
Where $facebook is initialized Facebook PHP SDK object. $data['id'] is id of uploaded photo.
Notes: 1. fileUpload option has to be set when initializing Facebook object:
$facebook = new Facebook(array(
/*..*/
'fileUpload' => true,
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With