2013-03-04 3 views
0

사용자의 생일 날짜를 가져 오는 앱을 개발 중이지만 아직 작동하지 않습니다. 가장 이상한 점은이 애플리케이션이 개발자 페이 스북 인터페이스를 던져 디버깅하는 것이므로 완벽하게 작동한다는 것입니다. 그래서 왜 작동하지 않는지 모르겠습니다. ? 다음은 생일 점점 내 PHP 코드 : CBroe에서 언급 한 바와 같이생일 날짜가 작동하지 않습니다.

<?php 
if($user_id) { 

    // We have a user ID, so probably a logged in user. 
    // If not, we'll get an exception, which we handle below. 
    try { 

    $user_profile = $facebook->api('/me?fields=id,name,birthday', 'GET'); 
    print_r($user_profile); 
    //echo "Name: " . $user_profile['name']; 

    } catch(FacebookApiException $e) { 
    // If the user is logged out, you can have a 
    // user ID even though the access token is invalid. 
    // In this case, we'll get an exception, so we'll 
    // just ask the user to login again here. 
    $login_url = $facebook->getLoginUrl(); 
    echo 'Please <a href="' . $login_url . '">login.</a>'; 
    error_log($e->getType()); 
    error_log($e->getMessage()); 
    } 
} else { 

    // No user, print a link for the user to login 
    $login_url = $facebook->getLoginUrl(); 
    echo 'Please <a href="' . $login_url . '">login.</a>'; 

} 

이> 사람

+1

당신에게 사용자의 생일을 얻는 데 필요한 권한을 요청하지 않습니다. 문서를 확인하십시오. – CBroe

답변

0

감사합니다, 당신은 당신의 권한 범위에 user_birthday 필요를

$params = array(
    'scope' => 'user_birthday', 
    'redirect_uri' => 'https://www.myapp.com/post_login_page' 
); 

$loginUrl = $facebook->getLoginUrl($params); 
관련 문제