title: Posting to facebook page wall via curl
body: <p>I am trying to post to my facebook page wall using curl but i keep getting the following error</p>
  
  <pre><code>The user hasn't authorized the application to perform this action
  </code></pre>
  
  <p>How do i generate the correct access token using curl? if you go to this url <a href="http://developers.facebook.com/tools/explorer/" rel="nofollow">http://developers.facebook.com/tools/explorer/</a></p>
  
  <p>I can then put in the following <a href="https://graph.facebook.com/337588736279406/feed" rel="nofollow">https://graph.facebook.com/337588736279406/feed</a> and this will show my wall feed i can then change this to post and add a field for the message content if i then run this i get the following response.</p>
  
  <pre><code>    {
    "error": {
      "message": "(#200) The user hasn't authorised the application to perform this action", 
      "type": "OAuthException", 
      "code": 200
    }
  }
  </code></pre>
  
  <p>What do i have to do to authorize me as a user??</p>
  
  <p>Can someone help me on this.</p>
  
  <pre><code>    &lt;?php
  
  function postify($arr) {
      $fields_string = '';
      foreach ($arr as $key =&gt; $value) {
          $fields_string .= $key . '=' . $value . '&amp;';
      }
      return rtrim($fields_string, '&amp;');
  }
  
  
  $appid = 'app id';
  $redirect_url = 'http://stickynote.users36.interdns.co.uk';
  $app_secret = 'app secret';
  $page_id = '337588736279406';
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&amp;client_id='.$appid.'&amp;redirect_uri='.$redirect_url.'&amp;client_secret='.$app_secret.'&amp;perms=publish_stream');
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $output = curl_exec($ch);
  
  $output = explode("=", $output);
  
  curl_close($ch);
  
  $postdata = array(
      'message' =&gt; 'this is a test message',
  );
  
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/'.$page_id.'/feed?access_token='.$output[1].'');
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, postify($postdata));
  $check = curl_exec($ch);
  
  print_r($check);        
  
  ?&gt;
  </code></pre>