Skip to content

Instantly share code, notes, and snippets.

@SecureCloud-biz
Forked from niraj-shah/ban_user.php
Created July 13, 2014 00:16
Show Gist options
  • Save SecureCloud-biz/6e18def09ff5946b3602 to your computer and use it in GitHub Desktop.
Save SecureCloud-biz/6e18def09ff5946b3602 to your computer and use it in GitHub Desktop.
<?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