我只是想让PHP Connector连接到Facebook,以便在页面上发布墙上的帖子 . 所以我不是试图将墙贴发布到 Profiles 墙或其他任何东西 .
我已经阅读了一些教程和手册,我决定使用Facebook PHP-SDK(来自Naitik Shah)https://github.com/facebook/php-sdk/
我创建了Facebook App来通过它发布wallposts . 我收到 appId
和 api secret
. 我已经为我的页面添加了应用程序权限并尝试了示例代码
$facebook = new Facebook(array(
'appId' => 'my app id',
'secret' => 'my api secret',
'cookie' => false,
'domain' => 'domain.com'
));
domain.com =>我将发送api请求的域名 - >
$facebook->getSession();
$token = $facebook->getAccessToken();
$facebook->api('/123456789/feed', array(
'access_token' => $token,
'link' => 'http://www.example.com'
));
所以我想在页面墙上发布id为 123456789
的链接
请求没有警告/错误,但没有在正确的位置发布任何内容,也没有返回任何内容 .
感谢您对此问题的任何想法 .
使用过的教程:
How do you post to the wall on a facebook page (not profile)
http://blog.theunical.com/facebook-integration/5-steps-to-publish-on-a-facebook-wall-using-php/
http://www.moskjis.com/other-platforms/publish-facebook-page-wall-from-your-site
http://tips4php.net/2010/12/automatic-post-to-facebook-from-php-script/
2 回答
注意
'post'
部分 .如果您通过您提供的链接查看API的来源,您会看到:
当你没有
'post'
作为第二个参数而你的数组作为第三个参数时,它会变成get
如果您收到授权错误,请确保您已包含以下权限:
https://developers.facebook.com/docs/reference/api/post/