How to post to my own page using the Facebook API
according to the docs you will need publish_pages
permission to post as page from api v2.3 . Prior, it needed permission publish_actions
in addition to manage_pages
. Now they have introduced publish_pages
specifically for that purpose. .
A page access token with
publish_pages
permission can be used to
publish new posts on behalf of that page. Posts will appear in the
voice of the page.
Facebook PHP SDK: How can I post on page on behalf of page
To post on a page on behalf of the page, you need to use the page access token. Your current call:
$facebook -> api('/' . $admin_pages[0]["page_id"] . '/feed', 'post', array("caption" => "From web", "message" => "This is from my web at: " . time()));
is using the default (user) access token.
To get the page access token, make this call before publishing post:
\GET /{page-id}?fields=access_token
this will get you a page access token in the result, then simply use this to make your publishing feed call, just like this-
$facebook -> api(
'/' . $admin_pages[0]["page_id"] . '/feed',
'post',
array(
"caption" => "From web",
"message" => "This is from my web at: " . time(),
"access_token" => '{page_access_token}'
)
);
(If needed you can also get a never expiring token of your page, check here how to: What are the Steps to getting a Long Lasting Token For Posting To a Facebook Fan Page from a Server)
How to post to my own timeline/page without requesting publish_actions and manage_pages permissions?
It seems that around mid May they of went back on the review process, at least partially; if your user owns the app and the page then you should be able to publish to your stream or to your page without going through the review process... I guess you just don't have to ask for the permissions that triggers the review process.
I'll be testing this in a bit and I'll get back to you with my results.
UPDATE: Yup. I've just tested it... just ask for publish_actions, manage_pages and status_update and it'll let you autopost on your own page, just ignore the warning about the review process.
Post to my facebook page as page admin using php SDK
Posting as Page needs the publish_pages
permission. You have to authorize with publish_pages
and manage_pages
, and then you have to use a Page Token. You get one with the /me/accounts
endpoint.
And no, you do not need to go through the review process if only you will use the App. Just ignore the warning in the login popup.
Related Topics
Replace Only First Match Using Preg_Replace
Why PHP Iteration by Reference Returns a Duplicate Last Record
Sum Specific Values in a Multidimensional Array (Php)
Design Patterns: How to Create Database Object/Connection Only When Needed
Create New Xml File and Write Data to It
A Recursive Remove Directory Function for PHP
Remotely Destroy a Session in PHP (User Logs in Somewhere Else)
Foursquare API for Venue User Image Error
How to Get Unix Timestamp in PHP Based on Timezone
What Is Null Coalescing Assignment = Operator in PHP 7.4
Get Coupon Data from Woocommerce Orders
How to Solve Error 404 When Deploying Laravel Project to Cpanel
Authorization Header Missing in PHP Post Request
Category Hierarchy (Php/Mysql)
How to Select All Column Name from a Table in Laravel