Is it possible to post on Facebook wall as an application and not as a user? As far as I know that no application is a valid user for Facebook, there are many comments about posting as a page, not as a user or application.
How can I use the PHP Facebook API?
You need I wrote about it and made a deeper tutorial: publish_stream, manage_pages permission. The code is something like this:
& lt ;? Php // This code is a snippet of the example. Php script // // PHP-SDK from & lt; Https: //github.com /facebook/facebook-php-sdk/blob/master/examples/example.php> '../src/facebook.php' is required; // Create an example of our application (replace it with your app and secret) $ Facebook = new Facebook (array ('appId' => gt; 'APIID', 'Secret' => gt; // Get the User ID $ user = $ facebook- & gt; GetUser (); If ($ user) {try {$ page_id = 'page_id'; $ Page_info = $ facebook-> API ("/ $ page_id? Fields = access_token"); If ($ page_info ['access_token'])) {$ args = array ('access_token' = & gt; $ page_info ['access_token'], 'message' = & gt; "I am a page!") ; $ Post_id = $ facebook- & gt; API ("/ $ page_id / feed", "post", $ args); } And {$ permission = $ facebook-> API ("/ me / permission"); {! Array_key_exists ('publish_stream', $ permission ['data'] [0]) ||! Array_key_exists ('manage_pages', $ permissions ['data'] [0])) // // We do not have permissions // Warning Administrator or ask for permission! Header ("Location:". $ Facebook-> Millglyen Yule (array ("scope" => "publish_stream, manage_pages"))); }}} Hold (FacebookApiException $ e) {error_log ($ e); $ User = null; }} // login will require login or logout url depending on user location. If ($ user) {$ logoutUrl = $ facebook- & gt; GetLogoutUrl (); } And {$ loginUrl = $ facebook- & gt; GetLoginUrl (array ('scope' = & gt; 'manage_pages, publish_stream')); } // ... the rest of your code? & Gt;
Comments
Post a Comment