投递到Facebook页面墙 [英] Post to Facebook Page Wall

查看:231
本文介绍了投递到Facebook页面墙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是试图让PHP连接至Facebook的页面上的墙上张贴的帖子。
所以我不尝试后墙上张贴到个人资料墙上或其他任何东西。

我读过一些教程和手册,我决定使用Facebook PHP-SDK(从Naitik沙阿)
https://github.com/facebook/php-sdk/

我创建Facebook的应用程序通过它来发布wallposts。我收到的appid API秘密。我已经添加应用程序的权限到我的网页,并试图例如code

  $ Facebook的=新的Facebook(阵列(
    APPID=> 我的应用程序ID',
    '秘密'=> 我的API秘密,
    '饼干'=>假,
    '域'=> domain.com
));

domain.com =>站点我从中发送API请求
下一个 - >

  $ facebook->的getSession();
$令牌= $ facebook-> getAccessToken();
$ facebook-> API('/ 123456789 /饲料,阵列(
    ACCESS_TOKEN'=> $令牌,
    '链接'=> http://www.example.com
));

所以我想张贴在ID为页面的链接墙 123456789

该请求经过无警告/错误,但没有什么是张贴在正确的地方,不返回任何

感谢您对这个问题的想法。

用于教程:

<一个href=\"http://stackoverflow.com/questions/691425/how-do-you-post-to-the-wall-on-a-facebook-page-not-profile\">How你张贴在墙上的Facebook页面上(而不是个人资料)结果
<一href=\"http://blog.theunical.com/facebook-integration/5-steps-to-publish-on-a-facebook-wall-using-php/\" rel=\"nofollow\">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/自动后到Facebook的 - 从 - PHP脚本/


解决方案

  $ facebook-&GT; API('/ 123456789 /饲料','后',阵列(
    ACCESS_TOKEN'=&GT; $令牌,
    '链接'=&GT; http://www.example.com
));

请注意在部分。

如果你看一下源通过您所提供的链接的API,你会看到:

 保护功能_graph($路径,$方法=GET,$ PARAMS =阵列()){
    如果(is_array($方法)及&放大器;空($ PARAMS)){
      $ PARAMS = $方法;
      $方法=GET;
    }

当你没有作为第二个参数和你的数组作为第三个,它会在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆