I want to post on my facebook groups. This is my code:
$access_token = $facebook->getAccessToken();
$info = $facebook->api( '/me/groups', 'GET', array( 'access_token=' => $access_token ) );
$count = count($info['data']);
print "<h2>Alege grupul(".$count.") in care vrei sa postezi:</h2><br>";
$i = 0;
foreach ($info['data'] as $group) {
$group_name = $group['name'];
$group_id = $group['id'];
echo "<input type='checkbox' value ='".$group_id."'> ".$group_name."<br>";
if ($i == 0){
$post_url = '/'.$group_id.'/feed';
$msg_body = array(
'message' => 'TEST',
);
$postResult = $facebook->api($post_url, 'post', $msg_body );
}
$i++;
}
This is the code from the login part:
$loginUrl = $facebook->getLoginUrl(array (
'scope' => 'publish_stream,user_groups,user_about_me,user_interests,friends_groups,friends_interests,friends_about_me',
'redirect_uri' => 'http://facebook.ebis-servicii.ro/mytest/test.php'
));
This is the link , where I am coding now. The result is an interesting error:
Fatal error: Uncaught OAuthException: (#200) The user hasn't authorized the application to perform this action thrown....
I'm a totally newbie to this, this is the first time I'm using fb php api, so my question is what am I doing wrong ? Why am I getting this ?