Facebook Open Graph - post to all approved users feeds.

Posted by simnom on Stack Overflow See other posts from Stack Overflow or by simnom
Published on 2010-05-12T17:03:11Z Indexed on 2010/05/12 17:04 UTC
Read the original article Hit count: 282

Filed under:
|
|

Hi,

I'm struggling to get to grips with posting a feed item to all the members of an approved application.

Within the application settings for the user it is stating that the application has permission to post to the wall but I can only achieve this if that user is currently logged in to facebook. Obviously I would like this to function so that any items I uploaded are posted to all the members of the application at any one time.

I am using the Facebook PHP SDK from http://github.com/facebook/php-sdk/ and currrently my code is as follows:

    require 'src/facebook.php';


//Generates access token for this transaction
$accessToken = file_get_contents("https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=MyAppId&client_secret=MySecret");

//Gets the full user details as an object
$contents = json_decode(file_get_contents("https://graph.facebook.com/SomeUserId?scope=publish_stream&" . $accessToken));

print_r($contents);

if ($facebook->api('/' . $contents->id . '/feed', 'POST', 
            array(
                'title' => 'New and Improved, etc - 12/03/2010',
                'link' => 'http://www.ib3.co.uk/news/2010/03/12/new-and-improved--etc',
                'picture' => 'http://www.ib3.co.uk/userfiles/image/etc-booking.jpg',
                'scope' => 'publish_stream'
                )
            )==TRUE) {
        echo "message posted";
    } else {
        echo "message failed";
    }

The output from $contents shows the expected user details but nothing relating to the permissions for my application. Am I missing a trick here?

Then using the $facebook->api() function I am receiving a #200 - Permissions error. The application does not have permission to perform this action.

This is driving me a little potty as I suspect I'm missing something straightforward with the authorisation but what?

Many thanks in advance for an assistance offered.

© Stack Overflow or respective owner

Related posts about facebook

Related posts about facebook-api