Facebook 图:Post 图片作为页面而不是用户

Facebook graph: Post picture as page not as user

我正在使用 FB 应用程序将 post 发布到我的 FB 页面。 所以当我将此代码用于链接时,它起作用了。

 $facebook = new Facebook(array(
 'appId' => $fb_app_id,
 'secret' => $fb_secret,
 'cookie' => true
));

$attachment =  array(
        'access_token' => $row["token"],
        'name' => $_POST["name"],
        'picture' => $_POST["picture"],
        'message' => $_POST["message"],
        'link' => $_POST["link"]);
    try
    {
        $facebook->api("/".$row['id']."/feed", "POST", $attachment);
    }

    catch(Exception $e)
    {
         echo('exception caught '.$e->getMessage());
    }

但是,当我想将图片作为页面共享时:

$facebook = new Facebook(array(
     'appId' => $fb_app_id,
     'secret' => $fb_secret,
     'cookie' => true,
     'fileUpload' => true,
     'allowSignedRequest' => false 
    ));  

$attachment =  array('access_token' => $row["token"], 'url' => 'http://image.link.jpg', 'message'  => $_POST["message"]);
            try
            {
                $facebook->api("/".$row['id']."/photos", "POST", $attachment);  
            }
            catch(Exception $e)
            {
                echo('exception caught '.$e->getMessage());
            }

应用 post 图片作为用户。用户寻呼。 所以我发现我需要使用 publish_pages 权限,但我的访问令牌包含 publish_actions 和 publish_pages。我无法更改它,因为我对很多事情都使用一个访问令牌。

所以我不得不问,有没有办法从访问令牌中明确选择我想使用的权限。 FB API 页面和用户图片发布代码相同 /user_id/photos 和 /page_id/photos。

需要使用Page access token,没有别的办法。