我正在尝试在 facebook 墙上发布一个链接。但我得到了这些错误。请帮助我解决这个错误。
$config = array(
'appId' => 'xxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
if($user_id) {
try {
$facebook->api('/$user_id/feed','POST',
array( 'access_token' => $facebook->getAccessToken(),
'message' => 'Hello World!',
'link' => 'www.example.com'
)
);
} catch(FacebookApiException $e) {
$result = $e->getResult();
error_log(json_encode($result));
$login_url = $facebook->getLoginUrl( array(
'scope' => 'publish_stream'
));
echo 'Please <a href="' . $login_url . '">login.</a>';
error_log($e->getType());
error_log($e->getMessage());
}
echo '<br /><a href="' . $facebook->getLogoutUrl() . '">logout</a>';
} else {
as the redirect_uri, so we don't
// need to specify it here.
$login_url = $facebook->getLoginUrl( array( 'scope' => 'publish_stream' ) );
echo 'Please <a href="' . $login_url . '">login.</a>';
}
{"error":{"message":"(#1) An error occured while creating the share","type":"OAuthException","code":1}}
OAuthException
(#1) An error occured while creating the share
{"error":{"message":"(#1) An error occured while creating the share","type":"OAuthException","code":1}}
OAuthException (#1) 创建共享时发生错误