Howto use FB Graph to post a message on a feed (wall)

前端 未结 7 1732
谎友^
谎友^ 2020-12-23 12:50

I have created an app, and now i want to post a message on one of my friends wall with use of the new Graph API. Is this do-able?

I am already using oAuth and the Gr

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 13:26

    That is old way to get acces. In GRAPH first i generated code key with:

    $getLinkCode ='https://graph.facebook.com/oauth/authorize'.
                  '?client_id=YOUR_APPID'.
                  '&redirect_uri=YOUR_SITE'.
                  '&scope=publish_stream';
    

    And now when we have code key we can generate access_token from link:

    $getLinkToken='https://graph.facebook.com/oauth/access_token'.
                  '?client_id=YOUR_APPID'.
                  '&redirect_uri=YOUR_SITE'.
                  '&client_secret=YOUR_SECRET'.
                  '&code=CODE_KEY';
    

    But this access_token post your message as USER not APPLICATION... WHY?!

    If you want post on application wall use:

    $facebook->api( '/YOUR_APPID/feed/', 'post', array('access_token' => $this->access_token, 'message' => 'Playing around with FB Graph..'));
    

提交回复
热议问题