-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.php
executable file
·50 lines (29 loc) · 858 Bytes
/
test.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
require_once __DIR__ . '/vendor/autoload.php';
$fb = new Facebook\Facebook([
'app_id' => '834616683391182',
'app_secret' => '293a1ecef786f29df2b7872403cd5741',
'default_graph_version' => 'v2.10',
]);
print_r($fb);
try {
$pageHelper = $fb->getPageTabHelper();
$accessToken = $pageHelper->getAccessToken();
} catch(Facebook\FacebookExceptions\FacebookResponseException $e) {
echo 'Facebook Response Exception: ' . $e->getMessage();
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook Response Exception' . $e->getMessage();
}
var_dump($accesToken);
if (isset($accessToken)) {
echo 'Logged In.\n';
} else {
echo 'Not Logged In \n';
}
try {
$response = $fb->get('/me');
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'error in getting response: ' . $e->getMessage();
}
print_r($response);
?>