我一整天都在努力解决这个问题,但显然这对我不起作用。 我正在做的是...要求登录facebook,然后将该用户添加到一个组(发送邀请)。我试图在这里遵循API文档: https://developers.facebook.com/docs/reference/api/group/#invite_member 没有运气。
我的代码如下:
<?php
require "fb/facebook.php";
$access_token = "app_token_here";
$facebook = new Facebook(array(
'appId' => 'appId',
'secret' => 'secretBlabla',
'cookie' => true,
'allowSignedRequest' => false,
));
$params = array('scope' => 'read_friendlists,read_insights,user_about_me,user_birthday,user_groups,user_interests,user_likes,user_location,user_relationships,user_website');
$fuser = $facebook->getUser();
if ($fuser) {
try {
$user_profile = $facebook->api("/me");
} catch (FacebookApiException $e) {
error_log($e);
$fuser = null;
}
}
if ($fuser) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl($params);
}
$page = "/XXXXXX/members/".$fuser;
$token=$facebook->getAccessToken();
$facebook->api($page, "POST", array("access_token"=>$access_token)); // i've tried with $token as well
我得到的错误:
PHP Fatal error: Uncaught OAuthException: (#3) Unknown method\n
知道我做错了吗?
谢谢