我怎样才能';喜欢';使用Facebook SDK API的页面/url


How can I 'Like' pages / url with Facebook SDK API?

我使用的是以下代码:

$facebook->api('/me/likes/', 'post',  array('url' => 'http://www.google.com'));

我得到以下错误:

Fatal error: Uncaught OAuthException: (#200) App does not have permission to make this call thrown in

范围(权限)为:

'scope' => 'publish_stream, email'

唯一可以通过编程方式喜欢的是带有likes连接的facebook对象

取自https://developers.facebook.com/docs/reference/api/:

你可以评论或点赞任何有/评论或/点赞的对象通过过帐到的连接https://graph.facebook.com/OBJECT_ID/comments和https://graph.facebook.com/OBJECT_ID/likes


更新:

user对象也有一个点赞连接,但用于聚合其他对象的点赞,不可能"点赞"用户。(谢天谢地;P)

感谢@Juicy Scripter指出这一点。。。

来源:https://developers.facebook.com/docs/reference/api/page/

要从用户那里获得页面点赞列表,您需要使用至少具有user_likes权限的有效用户访问令牌HTTP get To /me/likes没有API方法调用来将页面添加到点赞或从点赞中移除页面。