如何解决如何在Facebook上共享外部链接或URL
| 我需要编写将发送链接到Facebook Fanpage墙的应用程序。 我使用的是PHP SDK v3。有一个示例如何发布内容:require \'facebook.php\';
$facebook = new Facebook(array(
\'appId\' => \'XXXX\',\'secret\' => \'YYYYYYYYYY\',\'cookie\' => true,));
$fbsession = $facebook->getSession();
if ($fbsession) {
$attachment = array(
\'message\' => \'this is my message\',\'name\' => \'This is my demo Facebook application!\',\'caption\' => \"Caption of the Post\",\'link\' => \'http://www.lycos.com\',\'description\' => \'Test de post depuis application PHP\',\'picture\' => \'http://www.lalibre.be/img/logoLaLibre.gif\',\'actions\' => array(array(\'name\' => \'Get Search\',\'link\' => \'http://www.google.com\'))
);
$result = $facebook->api(\'/USER_WALL/feed/\',\'post\',$attachment);
}
而且效果很好。问题是我只想发布普通的Facebook链接(带有链接图标,没有应用程序名称和“共享”按钮)
像这样的东西:
$result = $facebook->api(\'/USER_WALL/feed/\',\'link\',$attachment);
gives me an error (Fatal error: Uncaught Exception: Unsupported method,link thrown in /home/.../src/base_facebook.php on line 959)
任何想法如何做到这一点?
我找到了两个指向FB文档的链接:
http://developers.facebook.com/docs/reference/rest/links.post/
http://developers.facebook.com/docs/reference/api/link/
但我仍然不知道在PHP-SDK v3中使用它
http://developers.facebook.com/docs/reference/rest/links.post/
http://developers.facebook.com/docs/reference/api/link/
解决方法
在此网站上查看此示例。它是用户墙上状态更新和发布技术的完整实现。链接到教程
阅读评论后进行编辑
使用以下网址共享自定义链接:
http://www.facebook.com/sharer.php?u=http://www.YourUrlThatYouWantToShare.com
,解决了:
$attachment = array(
\'access_token\'=>TOKEN,\'message\'=>\'message_here\',\'link\' => \'http://www.example.com\',);
$result = $facebook->api(
\'me/links\',\'post\',$attachment
);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。