php
  • facebook
  • facebook-fql
  • 2011-01-23 33 views 0 likes 
    0

    我有這個漂亮的股票通用代碼。如果我登錄(應用程序管理員),它會顯示我的所有狀態。如果我與任何其他用戶一起登錄,則不顯示任何內容。爲什麼?Facebook的FQL查詢狀態表 - 不工作php

    <?php 
    header('p3p: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"'); 
    
    include_once('facebook.php'); 
    
    
        $app_id = '289544004746'; 
    
    
    // Create our Application instance (replace this with your appId and secret). 
    $facebook = new Facebook(array(
        'appId' => '289544004746', 
        'secret' => '5772f9f5abbcc84e794c28169a399d4e', 
        '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); 
        } 
    } 
    
    // login or logout url will be needed depending on current user state. 
    if ($me) { 
        $logoutUrl = $facebook->getLogoutUrl(array('next' => 'http://autobotcentral.info/logout.php')); 
    echo "<a href='$logoutUrl'>Log out </a>"; 
    } else { 
        $loginUrl = $facebook->getLoginUrl(array('req_perms' => 'user_activities,user_status,read_status')); 
    echo "<a href='$loginUrl'>Login</a>"; 
    ?> 
    <html> 
    <head> 
    
    </head> 
    </html> 
    <?php 
    } 
    
    
    $result = $facebook->api(array(
        'query' => 'SELECT uid,status_id,message FROM status WHERE uid = me()', 
        'method' => 'fql.query')); 
    print_r($result); 
    ?> 
    

    回答

    2

    您需要接受user_status擴展permision來獲取用戶的狀態

    http://developers.facebook.com/docs/authentication/permissions

    你可以做,使用FB.login

    相關問題