du970294 2014-07-10 12:08
浏览 42

php-custom隐私设置与Facebook SDK Feed帖子无法正常工作

I am trying to post a simple message on my wall by using the Facebook PHP SDK but I get some troubles when I try to set up custom privacy rules, here is my code:

try {

                    $response = (new FacebookRequest(
                      $session, 'POST', '/me/feed', array(
                        'message' => @$_GET['message'],
                        'privacy' => json_encode(array(
                                        'friends' => 'SOME_FRIENDS',
                                        'value' => 'CUSTOM',
                                        'allow' => implode(',', $friends)
                                    ))
                      )
                    ))->execute()->getGraphObject();

                    echo "Posted with id: " . $response->getProperty('id');

                  } catch(FacebookRequestException $e) {

                    echo "Exception occured, code: " . $e->getCode();
                    echo " with message: " . $e->getMessage();

                  }

And i get the fallowing error: Exception occured, code: 100 with message: (#100) 'friends' value was not recognized

Someone could help me ?

EDIT The problem is that i do not have the real ID of the the friends, but i do not know how to get it when they do not use my application, any idea ?

  • 写回答

1条回答 默认 最新

  • duanjin9035 2014-07-15 14:59
    关注

    If you see the Publish documentation for Feed, the privacy settings you are using are invalid. As you can no longer get IDs of friends (unless they use the application), so you cannot restrict posts to a select number of friends who's IDs you do not know.

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号