2013-03-06 67 views
1

即時通訊試圖獲得一些數據與Facebook的API。這裏是我的代碼Facebook的api不返回評論

<?php 
include 'src/facebook.php'; 

$facebook = new Facebook(array(
    'appId'  => 'xxx', 
    'secret' => 'xxx', 
    'cookie' => true 
));  
?> 
<!DOCTYPE html> 
<html> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <title></title> 
</head> 
<body> 
    <?php 
     $user = $facebook->getUser(); 

     if($user) 
     { 
      $user_profile = $facebook->api('/me/statuses'); 
      echo "<pre>", print_r($user_profile), "</pre>"; 

      echo "<a href=logout.php>Logout</a>"; 
     } 
     else 
     { 
      $login_url_params = array(
       'scope' => 'publish_stream,read_stream,offline_access,manage_pages' 
      ); 

      $login_url = $facebook->getLoginUrl($login_url_params); 

      //redirect to the login URL on facebook 
      header("Location: {$login_url}"); 
     } 
    ?> 
</body> 
</html> 

的問題是,當我print_r($user_profile)它顯示了所有應該配備$user_profile = $facebook->api('/me/statuses');的數據,但它並不顯示與狀態相關的評論。我在Graph API Explorer中試過這個,它工作正常(顯示所有的數據),但是在我的代碼中,當我運行它時;它沒有得到評論。

任何想法爲什麼會發生這種情況?

回答

0
$user_profile = $facebook->api('/me/feed');