0
嘗試後用Facebook PHP SDK的狀態更新。代碼如下。據我瞭解,我需要延長的權限,我在登錄URL中使用'& scope = publish_stream',但這仍然不起作用。Facebook的API的OAuth錯誤時拋出#200 '&範圍= publish_steam'
所以你可以看到它被設置。雖然這與本質上是相同的問題:Facebook OAuthException: "user hasn't authorized the application to perform this action"
該線程中的建議解決方案在此處不起作用。
<?php
echo "Posting to facebook..<br/>";
require './fb_src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'appId',
'secret' => 'secret',
'cookie' => true,
));
$session = $facebook->getSession();
$me = null;
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
header('Location: ' . $facebook->getLoginUrl(array('scope' => 'publish_stream')));
error_log($e);
}
}
else {
header('Location: ' . $facebook->getLoginUrl(array('scope' => 'publish_stream')));
}
print_r($me);
try {
$feed = $facebook->api('/me/feed', 'post', array('message' => 'Hello world!', 'cb' => ''));
} catch (FacebookApiException $e) {
print($e);
}
print_r($feed);
?>
你確定嗎?自從昨天req_perms不再工作,我改變了範圍,並再次工作... wtf? – Tobias 2011-05-22 04:56:44
req_perms現在適用於我。 – mkocubinski 2011-05-24 20:58:34