有誰知道是否有可能通過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