-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
58 lines (46 loc) · 1.24 KB
/
main.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
<?php
if(isset($_GET['details']))
{
$id = $_GET['details'];
$URL = 'https://graph.facebook.com/v2.8/'.$id.'?fields=id,name,picture.width(700).height(700),albums.limit(5){name,photos.limit(2){images}},posts.limit(5)&access_token=XXXX;
$details = file_get_contents($URL);
$details = json_decode($details,true);
// $details = $details['data'];
header('Content-Type: application/json');
echo json_encode($details) ;
}
else
{
if(isset($_GET['query']))
$Query = $_GET['query'];
else
$Query = 'usc';
if(isset($_GET['type']))
$Type = $_GET['type'];
else
$Type='user';
if($Type=='place')
{
$center=$_GET['center'];
$URL = 'https://graph.facebook.com/v2.8/search?q='.$Query.'&type='.$Type.'&fields=id,name,picture.width(700).height(700)¢er='.$center.'&access_token=XXXX';
}
else
{
$URL = 'https://graph.facebook.com/v2.8/search?q='.$Query.'&type='.$Type.'&fields=id,name,picture.width(700).height(700)&access_token=XXXX';
}
$response = file_get_contents($URL);
$response = json_decode($response,true);
$results=$response;
header('Content-Type: application/json');
echo json_encode($results);
/*foreach ($response as $item)
{
foreach ($item as $key) {
print_r($key['picture']['data']['url']);
echo $key['name'];
echo $key[ 'id'];
}
}
*/
}
?>