如何使用Facebook Graph API标记照片中的用户? [英] How can I tag a user in a photo using the Facebook Graph API?

查看:78
本文介绍了如何使用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:未知路径组件:\ / tags}} 
/ pre>

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



http://developers.facebook.com/docs/api#publishing



有人可以确认我不可能在最近上传的照片中标记用户吗?

解决方案

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



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



从Facebook开发人员看这篇文章 http://developers.facebook.com/blog/post/371 似乎可能新的API将永远不会支持设置标签让用户做标记。对于想要集成标记的应用(如我的),这是不幸的。


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?

解决方案

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

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.

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.

这篇关于如何使用Facebook Graph API标记照片中的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆