-1

好的,我无法弄清楚这里的问题是什么...我正在尝试将其作为页面发布到用户墙上。我不断收到字符串(53)“(#200)目标用户尚未授权此操作”这是完整代码

       session_start();
      $config = array();
      $config['appId'] = 'xxxxxxxxx';
      $config['secret'] = 'xxxxxxxx';
      $config['fileUpload'] = false; // optional
      $facebook = new Facebook($config);

        $params = array(
          'scope' => 'user_birthday, user_likes, publish_actions, email, publish_stream, manage_pages',
          'redirect_uri' => 'xxxxxxxxxxxxx'
        );

        $loginUrl = $facebook->getLoginUrl($params);
        $logoutUrl = $facebook->getLogoutUrl();
        $user_id = $facebook->getUser();
    ?>
    <html>
      <head></head>
      <body>

      <?
        if($user_id) {
          try {
            echo 'Please <a href="' . $logoutUrl . '">logout.</a>';
            $user_profile = $facebook->api('/me','GET');
            echo "Name: " . $user_profile['name'];
            $access_token = $facebook->getAccessToken();
            $page_id = 'xxxxxxxxxx';
            $result = $facebook->api("/me/accounts");
            foreach($result["data"] as $page) {
                if($page["id"] == $page_id) {
                    $page_access_token = $page["access_token"];
                    break;
                }
            }
            if( !empty($page_access_token) ) {
                $args = array(
                    'access_token'  => $page_access_token,
                    'message'       => "Hello Billy!!"
                );
                $post_id = $facebook->api("/{$user_profile['id']}/feed","post",$args);

            } else {
            }

    //        $page = $facebook->api("/{$page_id}",'GET');


          } catch(FacebookApiException $e) {
            error_log($e->getType());
            error_log($e->getMessage());
            ?><pre><?var_dump($e->getMessage())?></pre><?
          }   
        } else {
    ///
          echo 'Please <a href="' . $loginUrl . '">login.</a>';

        }

      ?>

      </body>
    </html>
4

1 回答 1

2

只是为了确认一下,您正在尝试向用户的个人资料或时间线发帖,并让帖子以主页作为发件人显示?

这是不可能的,而且从来没有。API 根本不支持它。

于 2013-01-16T21:10:43.270 回答