$APP_ID, 'secret' => $APP_SECRET, 'cookie' => true, )); //The following is copied from the php sdk example.php //You shouldn't need to change anything here $session = $facebook->getSession(); $me = null; if ($session) { try { $uid = $facebook->getUser(); $me = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); } } // login or logout url will be needed depending on current user state. if ($me) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); } ?> php-sdk

Post to page


api('/me/accounts'); //Loop through the array off accounts to find the page with a matching ID to the one we need foreach($accounts['data'] as $account){ if($account['id'] == $PAGE_ID){ $ACCESS_TOKEN = $account['access_token']; echo "

Page Access Token: $ACCESS_TOKEN

"; } } } ?>

Post to wall



Trying to post the following:
"; echo "$message

"; //To keep this as simple as possible, we'll only be posting a message to the wall with our access token we received from accounts $attachment = array('message' => $message, 'access_token' => $ACCESS_TOKEN); $result = $facebook->api('/'.$PAGE_ID.'/feed', 'post', $attachment); if($result){ echo "

Posted status update

"; } else { echo "

Unable to post update.

"; } } ?>