It’s the same situation as here, but now I need to post a message to the wall of a Facebook Page.
I tried the following (the other code is the same as in the answer):
$facebook->api('/PAGE-ID/feed', 'post', $attachment)
But I get the error
(#200) The user hasn’t authorized the application to perform this action`.
I think I have the wrong access_token for that action but where/how do I get the correct?
Facebooks documentation on obtaining access_tokens and permissions is documented on their site Here.
You will need to obtain a permanent access_token with the permissions to post to the users status page if you want to post offline. You must have the permanent (or offline_access) token in order to do this without worrying about the token expiring.
When requesting an access_token you can add an additional permissions attribute to the GET request that is issued, in that key you specify the additional permissions you would like.
EDIT:
The process for obtaining a token with scope permission is here, under the section “Authorization” look at the second example. It will have a “scope” sample requesting additional permissions. The permissions used to be documented in the OAuth flow, but they seem to have moved, sorry.