我有點困惑,因爲我無法弄清楚下面的代碼可能會出錯,因爲它不工作。無法在用戶牆上發佈
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'myapplicationid',
'secret' => 'myapplicationsecret',
));
$attachment = array(
'access_token'=> "user access token",
'message' => "Message Goes Here",
'name' => 'Title goes here',
'caption' => "some text",
'link' => 'https://apps.facebook.com/somelink/',
'description' => 'some description',
'picture' => "http://example.com/test.jpg"
);
try {
// Proceed knowing you have a user who is logged in and authenticated
$result = $facebook->api("/$userid/feed/",'post',$attachment);
} catch (FacebookApiException $e) {
error_log($e);
//$user = null;
}
在進行身份驗證並獲取訪問令牌時,我從用戶電子郵件publish_stream和publish_actions獲得了以下權限。我認爲publish_stream是推動牆貼的必要條件。任何在這方面的幫助將不勝感激。
請您得到錯誤更新? –
這就是它不會給出任何錯誤的全部內容,也不會發布:S –
您是否嘗試過執行$ result變量的var_dump,以便您可以查看Facebook api是否返回任何內容? –