2011-01-18 133 views

回答

0

在这一变化的/我/饲料/到你的页面ID,余did't尝试....只是检查

$attachment = array('message' => 'some meesgae', 
     'name' => 'This is my demo Facebook application!', 
     'caption' => "Caption of the Post", 
     'link' => 'mylink.com', 
     'description' => 'this is a description', 
     'actions' => array(array('name' => 'Get Search', 'link' => 'google.com'))); 
    $result = $facebook->api('/me/feed?access_token='.$access_token, 'post', $attachment); 
+0

你从哪里得到`$ access_token`? – NT3RP 2012-05-28 15:50:27

3

使用新Facebook PHP-SDK,这是很容易做到这一点。

要求:

  1. Extended Permissions,根据您的需要
  2. 页ID

现在,正如我所说,根据您的要求,您可能需要offline_accessmanage_pages,但到目前为止,这是这样做的最简单直接的方法是:

下载PHP SDK后,在example.php文件:

  • 采集publish_stream权限:

    <fb:login-button perms="publish_stream"></fb:login-button> 
    
  • 认证成功后,您发布的页面墙上,你正常user轮廓都以相同的方式(与使用相同的选项太多,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); 
    

结果:
alt text

请注意,这种方法需要你作为网页的管理员。

+0

这是使用Graph API而不是Open Graph。 – 2013-11-07 19:29:55

相关问题