如何使用 Facebook Graph API 在照片中标记用户?

问题描述:

我试过了:

$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);

它返回了我:

{"error":{"type":"QueryParseException","message":"Unknown path components: /tags"}}

这似乎不可能,因为它不在 Facebook 文档中:

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?

目前没有使用 Facebook Graph API 设置标签的机制.

There is no current mechanism to set tags with the Facebook Graph API.

您可以将 photos.addTag 与旧的 REST API 一起使用您应该可以在这里下载:http://pearhub.org/get/facebook-0.1.0.tgz.如果有人有更好的链接,我将不胜感激.

You can use photos.addTag with the old REST API which you should be able to download here: http://pearhub.org/get/facebook-0.1.0.tgz. If anyone has a better link, I would appreciate it.

查看来自 Facebook 开发人员的这篇文章 http://developers.facebook.com/blog/post/371 新 API 似乎永远不会支持设置标签让用户进行标记".这对于想要集成标记的应用(如我的)来说是不幸的.

Looking at this article from the Facebook developers http://developers.facebook.com/blog/post/371 it seems likely that the new API will never support setting tags "let the users do the tagging". This is unfortunate for apps (like mine) that want to integrate tagging.