0

用户在 symfony2.1 中通过 fosfacebookbundle 登录成功

与本主题相关:“请求此资源需要用户访问令牌。” 用于通知的 Facebook 图表

我想向用户发送通知。访问令牌如下所示...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 给了我这个:对不起,出了点问题!脸书公司

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

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

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

怎么了?

更新 developers.facebook.com/docs/concepts/notifications中的href是什么意思?

4

0 回答 0