0
下面的代碼是不工作的一些原因:需要幫助張貼到我自己的牆在Facebook中使用PHP
require './facebook.php';
$facebook = new Facebook(array(
'appId' => 'working_app_id',
'secret' => 'working_secret'
));
// Get User ID
$user = $facebook->getUser();
$token = $facebook->getAccessToken();
print $token; // token shows.
$attachment = array
(
'access_token'=>$token,
'message' => 'This is where the message will go.',
'name' => 'Name Text',
'link' => 'http://www.website.com',
'description' => 'Description text.'
);
$result = $facebook->api('/me/feed/','post',$attachment);
exit;
我收到以下錯誤:
Uncaught OAuthException: An active access token must be used to query information about the current user.
當我打印的令牌,它似乎是一個真正的令牌。我只是不知道我會做錯什麼。我想要做的只是發佈一個非常簡單的狀態更新到我自己的頁面。
我不知道爲什麼我似乎無法弄清楚這一點。我在這篇文章中將我的頭撞在了牆上,因爲它應該很簡單,從PHP發佈一個快速的小狀態更新到我在Facebook上的牆上。
注意:爲獲取我的appID和祕密而創建的應用程序類型是「網站」。
試試看那些描述! [我在這裏寫了答案] [1]! [1]:http://stackoverflow.com/questions/15629332/how-post-on-facebooks-timeline-via-cron – Ivan