有谁知道是否有可能通过Vb.Net或PHP使用Facebook SDK版本4创建Facebook通知。来自vb.net或PHP的Facebook通知?
理想情况下,我希望我的网站上的用户输入他们的Facebook登录信息,然后存储他们的[facebook id],这样我就可以通过VB.Net每周发送状态通知到他们的Facebook帐户。
编辑 到目前为止,我从JavaScript获取ID范围和测试其复制到PHP
<?php
$appId = '77585851581xxxx';
$appSecret = 'xxxx';
$userId = '1015273548332xxxx'; //Scope ID
$accesstoken = $appId . '|' . $appSecret;
$notificationText = 'The cake is a lie.';
//Get Access Token
$args = array('grant_type' => 'client_credentials',
'client_id' => $appId,
'client_secret' => $appSecret);
$ch = curl_init();
$url = 'https://graph.facebook.com/oauth/access_token';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$returnValue = curl_exec($ch);
curl_close($ch);
echo $returnValue;
$accesstoken = $returnValue;
//Set Notification
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, 'facebook');
$url = 'https://graph.facebook.com/' . $userId . '/notifications' .
'?access_token=' . $accesstoken .
'&template=' . $notificationText .
'&href=';
curl_setopt($ch, CURLOPT_URL, $url);
$curlResult = curl_exec($ch);
echo $curlResult;
?>
我现在得到的错误:
Sorry, something went wrong. We're working on getting this fixed as soon as we can.
问,如果事情是可能的,你应该去看看Facebook的文档; ) – luschn 2014-09-12 11:21:22
我已经有了并使用旧的Facebook API,它似乎是可能的,但在新版本的4 SDK下,它们全都混在一起。我已经搜索了谷歌的所有例子等,无法找到任何接近新的SDK,这就是为什么我问你们的帮助和建议。 – widget 2014-09-12 11:34:19
我不会使用sdk来实现简单的应用程序通知,但一些简单的curl调用已经足够好了。我会回答一些有用的链接。 – luschn 2014-09-12 11:45:14