【发布时间】:2011-09-23 22:04:35
【问题描述】:
以下代码由于某种原因无法正常工作:
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]:stackoverflow.com/questions/15629332/…