发贴到Facebook页面墙 [英] Post to Facebook Page Wall
问题描述
我只是试图让PHP连接器在Facebook上张贴墙上的信息页面。
所以我不想把墙贴贴到个人资料墙或其他任何东西。
我已经阅读了一些教程和手册,我决定使用Facebook PHP-SDK(来自Naitik Shah)
https://github.com/facebook/php -sdk /
我已经创建了Facebook应用程序来通过它发布墙壁邮件。我收到了 appId
和 api secret
。我已将应用程序权限添加到我的页面并尝试了示例代码
$ facebook = new Facebook(array(
' appId'=>'我的应用程序ID',
'secret'=>'我的api秘密',
'cookie'=> false,
'domain'=> domain.com'
));
domain.com =>我发送api请求的域
next - >
$ facebook-> getSession();
$ token = $ facebook-> getAccessToken();
$ facebook-> api('/ 123456789 / feed',array(
'access_token'=> $ token,
'link'=>'http:// www。 example.com'
));
所以我试图在id的墙壁上发布链接,ID为$ code> 123456789
该请求经过没有警告/错误,但没有发布在正确的地方,没有任何回报。
感谢任何关于这个问题的想法。
使用的教程:
如何发布到墙上一个Facebook页面(不是个人资料)
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 /
$ facebook- &api('/ 123456789 / feed','post',array(
'access_token'=> $ token,
'link'=> 'http://www.example.com'
));
请注意'post'
part。 / p>
如果您通过您提供的链接查看API的来源,您会看到:
protected function _graph($ path,$ method ='GET',$ params = array()){
if(is_array($ method)&& ){
$ params = $ method;
$ method ='GET';
}
当您没有'post' / code>作为第二个参数,您的数组作为第三个参数,它会变为
get
I'm just trying to make PHP Connector to Facebook for posting wall posts on a Page. So i'm not trying to post wall post to profile wall or anything else.
I've read some tutorials and manuals and i decided to use Facebook PHP-SDK (from Naitik Shah) https://github.com/facebook/php-sdk/
I've created Facebook App to post wallposts through it. I received appId
and api secret
. I've added application permissions to my Page and tried example code
$facebook = new Facebook(array(
'appId' => 'my app id',
'secret' => 'my api secret',
'cookie' => false,
'domain' => 'domain.com'
));
domain.com => domain from which i'm sending api requests next ->
$facebook->getSession();
$token = $facebook->getAccessToken();
$facebook->api('/123456789/feed', array(
'access_token' => $token,
'link' => 'http://www.example.com'
));
So i'm trying to post link on wall of page with id 123456789
The request goes through without warnings/errors but nothing is posted in right place and nothing is returned.
Thanks for any idea about this problem.
Used tutorials:
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/
$facebook->api('/123456789/feed', 'post', array(
'access_token' => $token,
'link' => 'http://www.example.com'
));
Note the 'post'
part.
If you look at the source for the API via the link you provided, you'll see:
protected function _graph($path, $method='GET', $params=array()) {
if (is_array($method) && empty($params)) {
$params = $method;
$method = 'GET';
}
When you don't have 'post'
as the second argument and your array as the third, it goes a get
这篇关于发贴到Facebook页面墙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!