forked from J2TeamNNL/J2Team-Community
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_all_post_FB.php
More file actions
56 lines (55 loc) · 1.79 KB
/
delete_all_post_FB.php
File metadata and controls
56 lines (55 loc) · 1.79 KB
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
48
49
50
51
52
53
54
55
56
<?php
ini_set('max_execution_time', 0);
//token full quyền
$token = "";
//điền ID nhóm, hoặc trang, hoặc cá nhân
$id_can_xoa = "";
//Tùy chỉnh thời gian xóa, điền true nếu muốn chọn tính năng này
$option = "false";
if($option=="true"){
//Lưu ý điền đúng theo quy tắc năm tháng ngày
//Điền thời gian từ ngày bao nhiêu
$since = "2016-01-01";
//Điền thời gian tới ngày bao nhiêu
$until = "2016-12-30";
$link = "https://graph.facebook.com/$id_can_xoa/feed?fields=id&limit=5000&access_token=$token&since=$since&until=$until";
}
else{
$link = "https://graph.facebook.com/$id_can_xoa/feed?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){
$id_lay = $each["id"];
$link = "https://graph.facebook.com/$id_lay?method=delete&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;
}
}
?>