title: Publish to Facebook Stream via PHP using Graph API
body: <p>I'm trying to post a message to a user's wall using the new graph API and PHP. Connection seems to work fine, but no post appears. I'm not sure how to set up the posting code correctly. Please help me out. Sorry for the broken-looking code, for some reason StackOverflow didn't want to close it all in the code block.</p>
  
  <p>Below is my full code. Am I missing an extender permission requests, or is that taken care in this code:</p>
  
  <h2>PHP Code</h2>
  
  <pre><code>&lt;?php
  
  include_once 'facebook.php';
  
  $facebook = new Facebook(array(
      'appId'  =&gt; 'xxxxxxxxxxxxxxxxxx',
      'secret' =&gt; 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
      'cookie' =&gt; true
  ));
  
  $session = $facebook-&gt;getSession();
  
  if (!$session) {
      $url = $facebook-&gt;getLoginUrl(array(
          'canvas' =&gt; 1,
          'fbconnect' =&gt; 0
      ));
      echo "&lt;script type='text/javascript'&gt;top.location.href = '$url';&lt;/script&gt;";
  
  } else {
      try {
          $uid = $facebook-&gt;getUser();
          $me = $facebook-&gt;api('/me');
          $updated = date("l, F j, Y", strtotime($me['updated_time']));
          echo "Hello " . $me['name'] . "&lt;br /&gt;";
          echo "You last updated your profile on " . $updated;
  
          $connectUrl = $facebook-&gt;getUrl(
            'www',
            'login.php',
            array_merge(array(
              'api_key'         =&gt; $facebook-&gt;getAppId(),
              'cancel_url'      =&gt; 'http://www.test.com',
              'req_perms'       =&gt; 'publish_stream',
              'display'         =&gt; 'page',
              'fbconnect'       =&gt; 1,
              'next'            =&gt; 'http://www.test.com',
              'return_session'  =&gt; 1,
              'session_version' =&gt; 3,
              'v'               =&gt; '1.0',
            ), $params)
          );
  
          $result = $facebook-&gt;api(
              '/me/feed/',
              'post',
              array('access_token' =&gt; $facebook-&gt;access_token, 'message' =&gt; 'Playing around with FB Graph..')
          );
  
      } catch (FacebookApiException $e) {
          echo "Error:" . print_r($e, true);
      }
  }
  ?&gt;
  </code></pre>