forked from J2TeamNNL/J2Team-Community
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_all_member.php
47 lines (46 loc) · 1.42 KB
/
delete_all_member.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
ini_set('max_execution_time', 0);
//token full quyền
$token = "";
//điền ID nhóm
$id_nhom = "";
//điền ID ban quản trị
$array_admin = ["123","234"];
$link = "https://graph.facebook.com/$id_nhom/members?fields=id&limit=5000&access_token=$token";
while (true) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $link,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
));
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response,JSON_UNESCAPED_UNICODE);
$datas = $data["data"];
foreach($datas as $each){
if(in_array($each["id"],$array_admin)) continue;
$id_mem = $each["id"];
$link = "https://graph.facebook.com/$id_nhom/members?method=delete&member=$id_mem&access_token=$token";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $link,
CURLOPT_RETURNTRANSFER => false,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
));
curl_exec($curl);
curl_close($curl);
sleep(5);
}
if(!empty($data["paging"]["next"])){
$link = $data["paging"]["next"];
}
else{
break;
}
}
?>