简体   繁体   中英

Like a Facebook Page using Facebook PHP SDK

I need to put a custom image for F Like. But it seems the only way to do it is by using Facebook APP, asking users permission and liking it via PHP SDK.

The last part is the one that does not work for me. Permission granted by user is "publish_actions" and "user_likes" (user_likes is just to know whether the user has already liked the page or not which works fine)

The code that I am trying to debug is.

$facebook->api('/me/likes', 'post', array('url'=>'<URL to Facebook page>'));

Any thoughts? I have tried enough searches and read forums, but can't find answer to "Is it possible or not" and if it is where am I wrong

The response I am getting is "(#200) App does not have permission to make this call"

In order to publish Like on a Facebook page, you must use Like button social plugin .

One way of publishing Likes on objects is by using Open Graph Like feature . This requires a publish_actions permission and the graph URL looks like:

https://graph.facebook.com/[User FB ID]/og.likes
object=OG_OBJECT_URL&access_token=USER_ACCESS_TOKEN

However, this currently doesn't support Facebook Pages.

检查以查看是否已禁用Wheather Facebook访问

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM