title: Dynamic post posting to page wall step-by-step what I did
body: <p>Ok so I finally managed to successfully link dynamic news posts on my website with my page's wall as Page (not user) through PHP.
  Still I'm wondering if my solution is correct, or if it'll work on the long-run.
  Having said that here's what I did:</p>
  
  <ul>
  <li>Created a profile to administrate the page</li>
  <li>Created the company page</li>
  <li>Created an app with the domain pointing to my site domain, and website pointing to my website url</li>
  <li>Disable offline_access deprecation in order to be able to issue offline_access tokens</li>
  <li>Found out my pageID through http:// graph.facebook.com/PAGE_NAME</li>
  <li>Went to https:// developers.facebook.com/tools/explorer/APP_ID</li>
  <li>Paste the pageID in the instead of the userID and clicked submit</li>
  <li>Then I clicked on get access token and checked manage_pages,publish_stream,offline_access</li>
  </ul>
  
  <p>(when this alone didn't work, I visited <a href="https://developers.facebook.com/docs/authentication/" rel="nofollow">https://developers.facebook.com/docs/authentication/</a> and under "Page Login" I found out that Page Login requires a different type of token...)</p>
  
  <ul>
  <li>Manually get token from <a href="https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&amp;redirect_uri=YOUR_URL&amp;scope=manage_pages,publish_stream,offline_access&amp;response_type=token" rel="nofollow">https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&amp;redirect_uri=YOUR_URL&amp;scope=manage_pages,publish_stream,offline_access&amp;response_type=token</a></li>
  <li>redirect_uri in this case can be anything, we just wanted the url token parameter sent back</li>
  <li>Copy the token that is sent back from the URL (if it all went well the expires url param is set to 0 in the response)</li>
  <li>then I basically did this PHP script:</li>
  </ul>
  
  <pre class="lang-php prettyprint-override"><code>require_once('facebook-sdk/facebook.php');
  //Required facebook auth vars
  $appID = 'APP_ID';
  $appSecret = 'APP_SECRET';
  $pageID = 'PAGE_ID';
  $appOfflineToken = 'TOKEN_RETURNED_IN_PREVIOUS_STEP';
  $pageTokenURL = 'https://graph.facebook.com/me/accounts?access_token=';
  $access_token = '';
  
  //connect to facebook app
  $facebook = new Facebook(array(
      'appId'  =&gt; $appID,
      'secret' =&gt; $appSecret,
      'cookie' =&gt; true
  ));
  
  //get page managed pages information
  $jsonData = file_get_contents($pageTokenURL.$appOfflineToken);
  $content = json_decode($jsonData, true);
  
  //filter access_token for desired page using pageID
  foreach($content['data'] as $item) {
      if($item['id'] == $pageID){
          $access_token = $item['access_token'];
          break;
      }
  }
  
  //format post
  $post =  array(
      'access_token' =&gt; $access_token,
      'picture' =&gt; "http://URL_TO_PICTURE,
      'link' =&gt; "http://URL_TO_NEWS_POST",
      'name' =&gt; "NEWS_TITLE",
      'description' =&gt; 'NEWS_DESCRIPTION'
  );
  
  //post content to page wall
  $res = $facebook-&gt;api('/'.$pageID.'/feed', 'POST', $post);
  </code></pre>
  
  <p>so my question is ... even though this seems farfetched ... is it correct? well at least it works!</p>
  
  <p>PS: sorry about the links but could only submit 2 in this post ... not enough street cred it seems :p</p>