Last active
December 21, 2015 00:48
-
-
Save niraj-shah/6222857 to your computer and use it in GitHub Desktop.
Ban a user from your Facebook Application using PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// change these to match your app | |
$app_id = '1234567890'; | |
$app_secret = 'abcdefghijklmnopqrstuvwxyz'; | |
// init facebook class | |
$facebook = new Facebook( array( 'appId' => $app_id, 'secret' => $app_secret ) ); | |
/* Ban Users */ | |
// call POST {app_id}/banned/ using app access_token and comma separated list of uids | |
$ban = $facebook->api( $app_id . '/banned', 'POST', array( | |
'access_token' => $app_id . '|' . $app_secret, | |
'uid' => '1234567890,5678901234' | |
) ); | |
// $ban will return true if successful | |
print_r( $ban ); | |
/* Unban Users */ | |
// call DELETE {app_id}/banned/{user_id} using app access_token | |
$unban = $facebook->api( $app_id . '/banned/' . $user_id, 'DELETE', array( 'access_token' => $app_id . '|' . $app_secret ) ); | |
// $unban will return true if successful | |
print_r( $unban ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment