i need to authenticate before posting to my own wall, so here is my code
function get_app_token($appid, $appsecret)
{
$args = array(
\'grant_type\' => \'c
Value of $token
is access_token=<YOUR_ACCESS_TOKEN>
You cannot pass $token
value directly to the access_token
parameter.
$token = get_app_token($appid, $appsecret);
$access_token = split('=',$token);
$attachment = array(
'message' => '',
'access_token' => $access_token[1],
'name' => 'Attachment Name',
'caption' => 'Attachment Caption',
'link' => 'http://apps.facebook.com/xxxxxx/',
'description' => 'Description .....',
'picture' => 'http://www.google.com/logo.jpg',
'actions' => array(array('name' => 'Action Text',
'link' => 'http://apps.facebook.com/xxxxxx/'))
);
Hope this will helps in making that work... :)
you can get access_token from session array of facebook object directly.
$session = $facebook->getSession();
$session['access_token'];
of course you need to be authorized. if session is not set you must redirect to loginUrl
$facebook->getLoginUrl(array('req_perms' => 'email,read_stream,publish_stream'));
// this will return url for your authorization
and request permission you need.
A client_credentials
access token doesn't give any access to /me
(who would "me" be in this case? there's nothing that ties it to a user), let alone posting access. It is for use only with application-level Graph API calls, like to get an application's Insights data.