Created
June 1, 2011 16:39
-
-
Save colmdoyle/1002713 to your computer and use it in GitHub Desktop.
A script to remove all test users associated with your Facebook Platform Application
This file contains 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 | |
// jSON URL which should be requested | |
$json_url = 'https://graph.facebook.com/YOUR_APP_ID/accounts/test-users?access_token=YOUR_APP_ID|YOUR_APP_SECRET'; | |
// Initializing curl | |
$ch = curl_init( $json_url ); | |
// Configuring curl options | |
$options = array( | |
CURLOPT_RETURNTRANSFER => true, | |
); | |
// Setting curl options | |
curl_setopt_array( $ch, $options ); | |
// Getting results | |
$result = curl_exec($ch); // Getting jSON result string | |
$resultArray = json_decode($result, true); | |
foreach($resultArray as $nestedArray) | |
{ | |
foreach($nestedArray as $superNested) | |
{ | |
$testUID = $superNested["id"]; | |
$access_token = $superNested["access_token"]; | |
$string = "https://graph.facebook.com/$testUID?method=delete&access_token=$access_token"; | |
$nukeCh = curl_init($string); | |
echo($string.'<br/>'); | |
curl_exec($nukeCh); | |
echo('<br/>'); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍