0

I'm trying to publish a feed to my users' Facebook wall. I use Facebook Connect for my site. I have generated the link with getLoginUrl() with email, offline_access and publish_stream permissions.

My users' click on this link, authenticate with facebook and comes back to my site. When they do, i'm getting their's ID with getUser().

Then i'm trying to publish a post to their walls. I use this:

$user = $facebook->getUser();

try {
    $publishStream = $facebook->api("/$user/feed", 'post', array(
        'message' => "Mesaj icerigi",
        'link'    => 'http://ithinkdiff.net',
        'picture' => 'http://thinkdiff.net/ithinkdiff.png',
        'name'    => 'iOS Apps & Games',
        'description'=> 'Checkout iOS apps and games from iThinkdiff.net. I found some of them are just awesome!'
        )
    );
} catch (FacebookApiException $e) {
    print_r($e);
}

But everytime i try to that, i got an error. Api exception or something. What i'm doing wrong?

Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
  • Could you give more detail on what the error message is? Specifically, what does print_r($e) output? – dsas Aug 09 '12 at 23:30
  • @dsas That would definitely be useful. – citruspi Aug 09 '12 at 23:34
  • Something like this : FacebookApiException Object ( [result:protected] => Array ( [error] => Array ( [message] => (#1) An error occured while creating the share [type] => OAuthException [code] => 1 ) – Ergin Keleş Aug 10 '12 at 00:00
  • Anyone help? I'm stuck at here. – Ergin Keleş Aug 10 '12 at 18:20
  • I've never used facebook sdk, but I think that what is happening is that the user is logged in but you do not have permission to share to their feed. Can you check that publish_stream has been granted? – dsas Oct 05 '12 at 00:04

0 Answers0