示例代码很受欢迎,我似乎在网上找不到任何简单的例子.
Sample code is appreciated, I can't seem to find any simple examples of this online.
使用新的 Facebook PHP-SDK,很容易做到这一点.
Using the new Facebook PHP-SDK, it's very easy to accomplish this.
要求:
现在正如我所说,根据您的要求,您可能需要 offline_access
、manage_pages
,但目前这是最简单的直接方法:
Now as I said, depending on your requirements you may need offline_access
, manage_pages
, but for now this is the simplest straight forward way of doing this:
下载PHP SDK后,在example.php
文件中:
After downloading the PHP SDK, and in the example.php
file:
获取publish_stream
权限:
<fb:login-button perms="publish_stream"></fb:login-button>
认证成功后,您在页面墙上发布与正常发布相同的方式用户 个人资料(也有相同的选项,消息、图片、链接、名称、标题、描述、来源
):
After successful authentication, you post to the page wall the same way you do it for normal user profile (and with the same options too, message, picture, link, name, caption, description, source
):
$page_id = '123456789';
$feed_array = array(
'message' => "Hello world!"
);
$page_post = $facebook->api("/$page_id/feed","post",$feed_array);
结果:
请注意,此方法要求您是页面管理员.
这篇关于如何使用 PHP 和 Open Graph API 发布到 Facebook 粉丝页面的墙上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!