我在使用开放图形授权发布到访问者墙上时遇到了问题,而且似乎无法找出我错在哪里。我正在使用Github的PHP/SDK库。这里是我的代码:用图形和PHP发布到Facebook墙
<?php
require_once('facebook.php');
$facebook = new Facebook(array(
'appId' => 'APP_ID',
'secret' => 'APP_SECRET',
'cookie' => true,
));
$session = $facebook->getSession();
$me = null;
//session-based api call
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}
//post to wall/stream function
if(isset($_POST['status'])) {
try {
$result = $facebook->api(
'/me/feed',
'post',
array(
'access_token' => 'ACCESS_TOKEN',
'message' => $_POST['status']
)
);
} catch (FacebookApiException $e) {
echo 'Error: ' . print_r($e, true);
}
}
?>
<!-- HTML Form -->
<form name="" action="index.php" method="post">
<input type="text" name="status" id="status" value="">
<input type="submit" value="submit">
</form>
我不知道发生了什么事情,我已经通过一个十亿教程,文章,交流梳理等,好像我做的一切权利。任何帮助将不胜感激。
你如何使用你的ACCESS_TOKEN? – 2011-05-08 22:53:32