【问题标题】:Facebook; posting a link to a fanpageFacebook;发布一个粉丝专页的链接
【发布时间】:2010-02-09 22:23:38
【问题描述】:

我有一个网络应用程序,允许用户在他们的一篇文章在他们的网站上发布时发布一个小宣传。现在,我可以使用保存在表格中的 session_key 将相同的链接发布到用户的墙上,但我无法在粉丝页面上发布相同的链接(我拥有所需页面的权限和 ID)。

本质上我想要的功能是:http://wiki.developers.facebook.com/index.php/Links.post,但要一个页面。到目前为止,我能找到的所有东西都利用了 steam.publish 函数,这并不完全相同。

我希望在我错过的 link.post 函数中有一个隐藏参数(如 target_id)(因为 facebook wiki 很糟糕)。

感谢任何帮助 :) 如果没有函数,也许有人可以帮助我使用 stream.publish 的参数使帖子的内容看起来相同?

【问题讨论】:

    标签: php facebook


    【解决方案1】:

    好吧,我找不到使用 link_post() 函数发布到粉丝专页的方法,因此我决定将 stream.publish 结果调整为看起来相同的方式。我必须围绕变量做很多跳舞才能获得相同的效果,但它确实有效。在这种情况下,我必须获取“描述”元标记、页面内容中的第一张图片以及页面标题。

    我希望这可以帮助某人:

    $title = 'Title of the article, or the title of your webpage';
    $message = 'Caption that will go with the link, from the user';
    $description = 'I put what would have been in the description metatag, which is what the post link seems to grab';
    $fb_thumbnail = ''; // a link to the first image in your article
    $target_id = 'XXXXXX'; // the id of the fan page you want to post to
    
    $attachment = array( 'name' => $title,
                    'href' => 'http://'.$url,
                    'description' => $description,
                    'media' => array(array('type' => 'image',
                                    'src' => $fb_thumbnail,
                                    'href' => 'http://'.$url))); // I would get an error with the HREF but that's because I wasn't including the "http://" bit in the link
    
                    $attachment = json_encode($attachment);
    
                    $facebook->api_client->stream_publish($message, $attachment,"",$target_id);
    

    【讨论】:

      猜你喜欢
      • 2012-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多