Search code examples
phpfacebookpublishpublishingtimeline

Publish to facebook timeline from app with a button


i feel so frustrated, since i have been looking for this all day, from hundreds of sites and with my accumulated frustration i´m not making my life easier.

My problem is this.. i have made an app for facebook in php, and now i want to put a button there that when people press it, it would send a post to their time line, with the permissions and all. I have seen a lot of things and have not been able to help my self, í´m almost having a stroke with this. Can some one please help me?????


Solution

  • Facebook has decent documentation. Besides the overall reference mentioned in the comment, start here:

    https://developers.facebook.com/docs/php/gettingstarted/ https://developers.facebook.com/docs/php/howto/postwithgraphapi

    Be sure to create a Facebook app to get the App ID that you'll need to configure the Facebook object.

    The part of the code that does the actual post is this:

    $facebook->api('/me/feed', 'POST',
      array(
        'link' => 'www.example.com',
        'message' => 'Posting with the PHP SDK!'
    

    ));

    I know you mentioned doing this with PHP. I have created similar functionality in a PHP app (post to a user's wall when clicking a button), but I used the Javascript API, so it's invoked client-side. There is similar documentation for the Javascript API by Facebook. Just a thought.

    If you are getting specific errors, please post them and you'll get more specific answers.