发布到我的Facebook公司页面作为页面

I've been succesfully been using the following code to post to my fan page AS the page:

    //Call Facebook API
$facebook = new Facebook(array(
  'appId'  => $appId,
  'secret' => $appSecret,
  'cookie' => true,
));

$fbPost = array('access_token' => $fbToken, 'message' => $string2 ,'name' => $string2, 'description'=> $description,'link'=> $unshort);

try{
    //This is to post a link!
    $postResult = $facebook->api('/xxxxxxxxxxxxxxx/feed', 'POST', $fbPost );
    echo 'Posted';
    echo '<br />';          
} catch (Exception $e){
    echo 'Didnt Work';
    echo '<br />';          
    echo $e->getMessage();
}

However, my account was temporarily blocked by facebook (don't ask... malicious competitor). After clearing up the situation, the ban on my account has been lifted and I can post on my fan page, however my above PHP script will only post as myself on the page, NOT as the page itself.

After the ban was lifted I had to renew my access tokens, but did this as normal. Since my code hasn't changed, Im guessing it has to do with how I renewd my access token, but everything seems to be in order.

Any ideas as to why my code is now posting as me (the admin) rather then as the page itself?

Thank you!

I think that's because your Access Token is missing the manage_pages. Try to debug your Access Token.

According to the Page Feed documentation, a Page Access Token with publish_actions permission can be used to publish new posts on behalf of that page. To obtain a page access token you need to start by obtaining a user access token and asking for the manage_pages permission. Once you have the user access token you then get the page access token via the Graph API, by making a GET request to /{user-id}/accounts. This will give you a Page Access Token which will allow you to publish as a Page.

For the page Access Token, you can simply do something like:

$userAccounts = $facebook->api('/me/accounts');

And this will give you the following output:

{
  "data": [
    {
      "category": "Product/service",
      "name": "Sample Page",
      "access_token": "{access-token}",
      "id": "1234567890",
      "perms": [
        "ADMINISTER",
        "EDIT_PROFILE",
        "CREATE_CONTENT",
        "MODERATE_CONTENT",
        "CREATE_ADS",
        "BASIC_ADMIN"
      ]
    }, 
}

More details can be found at: Page Tokens.