title: PHP Facebook SDK Post on Page as Admin
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3627684/facebook-graph-api-posting-to-fan-page-as-an-admin">Facebook Graph Api - Posting to Fan Page as an Admin</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to have a form on my site where I can submit a blog post and then send that same blog post to my page on facebook.</p>
  
  <p>My page is: <a href="https://www.facebook.com/foreveraloneminecraft" rel="nofollow noreferrer">https://www.facebook.com/foreveraloneminecraft</a></p>
  
  <p>I want it to post it as if I was logged in and manually posted (like all the other posts on there).</p>
  
  <p>I have been searching all over the place and everything I find either never actually posts something or throws an error.</p>
  
  <p>This is what I got so far after searching all over:</p>
  
  <pre><code>&lt;?php
  include('core/init.inc.php');
  require_once('libs/parser.php'); // path to Recruiting Parsers' file
  $parser = new parser; //  start up Recruiting Parsers
  
  if(isset($_POST['submit'], $_POST['user'], $_POST['title'], $_POST['body'])
  {
      //--- Facebook Posting ------
      require_once('libs/facebook/facebook.php');
      $appid = '286964398044671';
      $appsecret = 'myappsecret';
      $pageid = '215852885143861';
      $token = 'mytoken';
  
      // Create our Application instance (replace this with your appId and secret).
      $facebook = new Facebook(array(
        'appId'  =&gt; $appid,
        'secret' =&gt; $appsecret,
      ));
  
      // Get the current access token
      //$token = $facebook-&gt;getAccessToken();
  
      //Information that makes up the facebook page post
      $attachment = array(
              'access_token' =&gt; $token,
              'message' =&gt; $_POST['body'], 
              'link'    =&gt; 'http://hgs1957.hostedd.com/news.php',
              'picture' =&gt; 'http://hgs1957.hostedd.com/images/foreverAloneMCguy.png',
              'name'    =&gt; $_POST['title'],
              'description'=&gt; 'Latest news for foreveralonemc.com.'
      );
  
      //Try to post to the facebook page
      try{
      $res = $facebook-&gt;api('/'.$pageid.'/feed','POST',$attachment);
  
      } catch (Exception $e){
  
          echo $e-&gt;getMessage();
      }
  
      //Add the post to the sql database of posts
      //add_post($_POST['user'], $_POST['title'], $_POST['body']);
  
      //Redirect to news feed
      header('Location: news.php');
      die();
  }
  ?&gt;
  </code></pre>
  
  <p>I used the appsecret from the token is that I got when using <a href="https://developers.facebook.com/tools/explorer/" rel="nofollow noreferrer">https://developers.facebook.com/tools/explorer/</a> with the permissions: publish_stream, status_update, manage_pages, publish_actions, offline_access
  After trying that it seems to post to the page wall but as me not as the page or admin.</p>
  
  <p>Anyone know if this is just a bug or what I am doing wrong?</p>