Facebook无法发送通知

时间:2013-03-18 01:12:10

标签: facebook facebook-graph-api

用户通过symfony2.1

中的fosfacebookbundle成功登录

与此主题相关:"A user access token is required to request this resource." Facebook graph for notifications

我想向用户发送通知。访问令牌看起来像...234|asdf...

$token_url = 'https://graph.facebook.com/oauth/access_token?grant_type=
                     client_credentials&client_id=' . $app_id . '&
                     client_secret=' . $app_secret;
$access_token = file_get_contents($token_url);
//After that I do a preg_split. Or for testing I print out the access token 
  and I define it manual in the php file `$access_token = '...234|asdf...';`

$userid = 12345;
$inviteMessage = 'Test_message';
$inviteMessage = urlencode($inviteMessage);
$url = "https://graph.facebook.com/" . $userid . "/notifications?access_token=" . 
                $access_token . "&template=" . $inviteMessage;
$c = curl_init($url);
// necessary so CURL doesn't dump the results on your page
curl_setopt($c, CURLOPT_POST, true);
$result = curl_exec($c);
curl_close($c);
$r = json_decode($result);
print_r($r);

print_r给了我这个:对不起,出了点问题! Facebook Inc。

如果我直接把它放在地址栏中:

https://graph.facebook.com/12345/notifications?access_token=access_token=...234|asdf...&template=Test_message

错误讯息: {    “错误”:{       “message”:“无效的OAuth访问令牌签名。”,       “type”:“OAuthException”,       “代码”:190    } }

有什么问题?

更新 在developers.facebook.com/docs/concepts/notifications?

中href的含义是什么?

0 个答案:

没有答案