네, 매우 간단합니다. 사용자가 원하는 그룹의 ID를 입력하고 범위 user_groups 권한을 요청하여 사용자가 가진 그룹을 쿼리 할 수 있습니다. PHP는 SDK와
당신은이 작업을 수행 할 수 있습니다
<?php
// Remember to copy files from the SDK's src/ directory to a
// directory in your application on the server, such as php-sdk/
require_once('php-sdk/facebook.php');
$config = array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
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,groups','GET');
$user_belongs_to_group= FALSE;
foreach($user_profile['groups']['data'] as $group){
if($group['id']==YOUR_GROUP_ID)
$user_belongs_to_group=TRUE;
}
if($user_belongs_to_group){
//Alright! the user belongs to the group
}
else{
//Oh snap you don't belong here, but you can if want to
}
} 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>';
}
?>
나는 페이스 북에서 잡고이 코드의 일부, 당신은 반환되는 데이터를 볼 수있을 때 여기에 그룹에 대한 쿼리 : https://developers.facebook.com/tools/explorer
보도 이름 뒤에 더하기 기호는 연결로 이동하고 그룹을 선택하고 보내기를 누르십시오