This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetFriends.php
71 lines (54 loc) · 1.6 KB
/
getFriends.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
//getting list of friends
require_once('vendor/facebook/php-sdk/src/facebook.php');
class Get_Friends{
public function __construct($id){
$this->secret_key="fe3a9c260de6710b79449236504136ea";
$this->app_id="1469715466577879";
$this->$id=$id;
echo $id;
$config=array(
'appId' => $this->app_id,
'secret' => $this->secret_key,
'file_upload' => false,
'allowSignedRequest' => false,
);
$this->facebook=new facebook($config);
}
public function get_a_users_friends($id) {
$user=$this->facebook->api('/'.$id);
$ids=get_users_ids_from_user($user);
return $ids;
}
public function get_users_ids_from_user($user) {
$friends=$this->facebook->api(
'/'.$user.'/friends'
);
return 0;
}
public function get_user() {
return $this->facebook->getUser();
}
public function get_friends() {
$eid="1452625398292441";
$friends=$this->facebook->api( array(
'method' => 'fql.query',
'query' => "SELECT name,mutual_friend_count,uid FROM user WHERE uid IN(
SELECT uid FROM event_member WHERE eid = $eid AND rsvp_status = 'attending'
) AND mutual_friend_count > 0 ORDER BY mutual_friend_count desc",
));
// $friends=$this->facebook->api(
// '/fql?q='.
// );
var_dump($friends);
// $this->friend_ids=$this->process_friend_ids($friends['data']);
return $friends;
}
// public function process_friend_ids($friends) {
// $friend_ids=[];
// foreach ($friends as $key => $friend) {
// $friend_ids[]=$friend['id'];
// }
// return $friend_ids;
// }
}