-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunction.php
executable file
·43 lines (43 loc) · 1.05 KB
/
function.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
<?php
/****************/
/* function.php */
/****************/
function curl($url, $post=null) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($post != null){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
function checktoken($token) {
$get = curl("https://graph.facebook.com/me/?fields=id&access_token=".$token);
$data = json_decode($get);
$id = $data->id;
if($id) {
return true;
} else {
return false;
}
}
function checktarget($token, $target) {
$get = curl("https://graph.facebook.com/".$target."/?fields=id&access_token=".$token);
$data = json_decode($get);
$id = $data->id;
if($id) {
return true;
} else {
return false;
}
}
function getdata($token, $target) {
$get = curl("https://graph.facebook.com/".$target."/?fields=id,name&access_token=".$token);
return json_decode($get);
}
?>