从Facebook应用程序发布到Facebook页面,而无需登录到Facebook [英] Posting to Facebook page from Facebook application without login to facebook

查看:200
本文介绍了从Facebook应用程序发布到Facebook页面,而无需登录到Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PHP发布到Facebook 页面. 我创建了一个Facebook应用程序,并且 我可以使用在

在任何access_token中都不需要如此. 我已从PAGE(和普通帐户)授予我的应用程序以下权限:publish_stream,manage_pages

但是...这似乎不适用于Facebook PAGE. 我似乎无法从我的应用发布到它. 我已经尝试了以下方法和其他组合,但是Facebook不会返回任何错误消息,也不会发帖:

$feed = '/MYPAGEID/feed';

$post_id = $facebook->api($feed, "post", $post);

非常感谢您的帮助!

解决方案

页面对象说:

在张贴到墙上时模拟页面(例如,以 Page,而不是当前用户),则必须将Page access_token与 manage_pages和publish_stream权限

将以下操作作为页面而不是当前页面执行 用户,您必须使用页面的访问令牌,而不是用户访问令牌 通常用于读取Graph API对象.此访问令牌可以是 通过向/USER_ID/accounts发出HTTP GET并使用 manage_pages权限.这将返回页面列表(包括 用户具有管理权限的应用程序配置文件页面) 访问,以及这些页面的access_tokens.或者,你 可以通过发出一个 使用manage_pages通过HTTP GET到/PAGE_ID?fields = access_token 权限,如上所述.发布到页面还需要 除非另有说明,否则publish_stream权限.

此外,请务必查看作为页面进行身份验证教程. >

i am trying to post into a Facebook Page using PHP. I have created a Facebook application, and I am able to post into regular accounts FEED, using the very helpful code i found out in : Daily Automatic post in facebook users wall .

to summarize it does:

$facebook = new Facebook(array('appId'  => 'xxxxxxxx',
                               'secret' => 'xxxxxxxxxxxxxx',));

$post = array('message'   => 'Message to user');

$post_id = $facebook->api("/$USER_ID/feed", "post", $post);

There is no need in any access_token what so ever. i have granted my application with the following permissions from the PAGE (and from the regular account) : publish_stream,manage_pages

But... this doesn't seem to work with Facebook PAGE. i do not seem to be able to post to it from my app. i have tried the following, and other combinations, but Facebook doesn't return any error message, nor doesn't posts:

$feed = '/MYPAGEID/feed';

$post_id = $facebook->api($feed, "post", $post);

Your help is very much appreciated!

解决方案

In the documentation for the Page object it says:

To impersonate the Page when posting to the wall (i.e. post as the Page, and not the current user), you must use a Page access_token with the manage_pages and publish_stream permissions

and

To perform the following operations as a Page, and not the current user, you must use the Page's access token, not the user access token commonly used for reading Graph API objects. This access token can be retrieved by issuing an HTTP GET to /USER_ID/accounts with the manage_pages permission. This will return a list of Pages (including application profile Pages) to which the user has administrative access, along with access_tokens for those Pages. Alternatively, you can get a page access token for a single, specific, page by issuing an HTTP GET to /PAGE_ID?fields=access_token with the manage_pages permission, as described above. Publishing to a Page also requires the publish_stream permission, unless otherwise noted.

Also, be sure to check the Authenticating as a Page tutorial.

这篇关于从Facebook应用程序发布到Facebook页面,而无需登录到Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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