1

How can i post stream ($facebook->api('/me/feed', 'post', $attachment);) to my app users on anytime. I think i can get access token via $facebook->getAccessToken(); but after, how can i post to wall?

ifaour
  • 38,035
  • 12
  • 72
  • 79
John
  • 169
  • 1
  • 3
  • 9

2 Answers2

0

Grant the publish_stream permission and use the user id after that instead of me:

$facebook->api("/$user_id/feed", 'post', $attachment);

For more information, check the last edit (EDIT 4) on this answer (also follow the discussion on the other answer that I linked to there).

Community
  • 1
  • 1
ifaour
  • 38,035
  • 12
  • 72
  • 79
0

First: See if the session is valid

if ($session) {
    try {
     $uid = $facebook->getUser();
    $me = $facebook->api('/me');

Second - IF it is valid, you will make the API call to post

       $facebook->api('/me/feed', 'post', array(
    'message'=> 'Sample Message', 
    'picture' => 'URL of Picture', 
    'link'=> 'URL',
    'description'=>'Description',
    'name'=> 'Name of Post',
    'privacy'=> 'privacy',
    'caption'=>'Caption',                                                                ) );
 } catch (FacebookApiException $e) {
        error_log($e);
      }
    }

It's simple, just copy all the code you see above, it should work out the box.