-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex2.php
78 lines (46 loc) · 1.5 KB
/
index2.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
71
72
73
74
75
76
77
78
<?php
require dirname(__FILE__).'/php-sdk/src/facebook.php';
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
$googleBaseURL="http://maps.googleapis.com/maps/api/staticmap?size=640x640&sensor=true";
$facebook = new Facebook(array(
'appId' => '267947846583709',
'secret' => '2bf606b5cd75c2a2be44f19a9ef2fb04',
));
$access_token="AAADzsng2xZA0BAMUSqX4cabnlYmEJPpBrO5lUbU7MawCNIAigXFtJ5fdILvTuw4oMWVFStbCuZBvFfygnp1rK3YjS2YgTeQuALtOso7QZDZD";
$fql = "SELECT current_location from user where uid IN (SELECT uid2 FROM friend WHERE uid1=me())";
$response = $facebook->api(array(
'access_token'=>$access_token,
'method' => 'fql.query',
'query' =>$fql,
));
$locationIDArray = array();
foreach ($response as $cur)
{
if($cur[current_location][id])
{
if(array_search($cur[current_location][id], $locationIDArray)===FALSE)
{
$locationIDArray[]=$cur[current_location][id];
}
}
}
$location_list=implode(",", $locationIDArray);
$fql = "SELECT latitude,longitude from place where page_id IN (".$location_list.")";
$response = $facebook->api(array(
'access_token'=>$access_token,
'method' => 'fql.query',
'query' =>$fql,
));
var_export($response);
foreach ($response as $key => $value) {
if($value[latitude]&&$value[longitude])
{
$googleBaseURL.="&markers=".round($value[latitude],2).",".round($value[longitude],2);
}
}
echo strlen($googleBaseURL);
echo $googleBaseURL;
?>