programmatically login to facebook and post to page (wall)

后端 未结 3 2399
长情又很酷
长情又很酷 2021-02-10 21:17

I have a website, and I need it to post status updates to a Facebook Page from time to time.

Using my personal Facebook account, I created an App, and a Page. So far, I\

相关标签:
3条回答
  • 2021-02-10 22:08

    This is what I use to do,

     // = SET WALL DATA HERE ===============
    $attachment = array(
    'access_token' => 'My Access token here',
    'message'      => '',
    'name'         => 'My Wall Post Header/Title Here',
    'caption'      => 'Small caption here',
    'link'         => 'http://www.mywebsite.org',
    'description'  => 'Wall Post Details Here',
    'picture'      => "http://www.mywebsite.org/images/logo.gif",
    );
    
    // =POST ON FACEBOOK WALL ==========================
    $this->facebook->api('/me/feed', 'POST', $attachment);
    , $attachment);
    

    So include your Facebook API, Get your Facebook Access token, SET data for your wall post and call for facebook api with me/feed method.

    This will make a wall post on your wall without asking for login.

    make sure you are using correct Access Token.

    0 讨论(0)
  • 2021-02-10 22:11

    Seems like you need to update status while you are offline from facebook. To do this you need to get the offline access permission of the app user and you need to have a "infinite" token for facebook app to access the APIs, so that your program can update anytime you want with out logging into facebook.

    You may get something you want here

    http://developers.facebook.com/docs/authentication/

    0 讨论(0)
  • 2021-02-10 22:14

    I'm a little late to the party here, but I thought I'd post my gist example for how to do something very similar. I added some functionality to fbconsole to make it easy to programmatically login with fbconsole.automatically_authenticate to make it much easier to access this information in a systematic way. This addition has not yet been incorporated into the master branch of fbconsole (it was just posted this morning), but it is available here in the meantime for those that are interested.

    0 讨论(0)
提交回复
热议问题