1

已经尝试了数周,但我的应用程序不会要求扩展权限,显然这意味着它之后也不会发布到时间线。

require_once('/wp-content/php-sdk/src/facebook.php');

$facebook = new Facebook(array(
  'appId' => 'xxxxxx',
  'secret' => 'xxxxxxx',
));

$user = $facebook->getUser();

if ($userID) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $ret_obj = $facebook->api('/me/feed', 'POST',
                                array(
                                  'link' => 'www.theaandrdepartment.com/raw',
                                  'message' => 'I just helped an Aussie band make it to    
radio play! By voting, you can too.'
                             ));
echo '<pre>Post ID: ' . $ret_obj['id'] . '</pre>';
  } catch (FacebookApiException $e) {
error_log($e);
$user = null;

}

} else { $login_url = $facebook->getLoginUrl(array(
                   'scope' => 'publish_stream'
                   ));
        header("Location: ".$login_url);
     }

如果有人可以提供帮助,那就太棒了。

我直接从 Facebook 示例中复制了大部分代码,但无济于事。

4

0 回答 0