-
-
Notifications
You must be signed in to change notification settings - Fork 227
/
invite_all_friend_to_group.PHP
36 lines (35 loc) · 1.05 KB
/
invite_all_friend_to_group.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
<?php
ini_set('max_execution_time', 0);
//token full quyền
$token = "";
//điền ID nhóm
$id_nhom = "";
$link = "https://graph.facebook.com/me/friends?fields=id&limit=5000&access_token=$token";
$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_mem = $each["id"];
$link = "https://graph.facebook.com/$id_nhom/members?method=post&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);
}
?>