-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlocation.php
More file actions
46 lines (46 loc) · 1.13 KB
/
location.php
File metadata and controls
46 lines (46 loc) · 1.13 KB
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
<?php
function getLat($code){
$query = "http://maps.google.com/maps/geo?q=".urlencode($code)."&output=json";
$data = file_get_contents($query);
// if data returned
if($data){
// convert into readable format
$data = json_decode($data);
$long = $data->Placemark[0]->Point->coordinates[0];
$lat = $data->Placemark[0]->Point->coordinates[1];
return ($lat);
}else{
return false;
}
}
function getLong($code){
$query = "http://maps.google.com/maps/geo?q=".urlencode($code)."&output=json";
$data = file_get_contents($query);
// if data returned
if($data){
// convert into readable format
$data = json_decode($data);
$long = $data->Placemark[0]->Point->coordinates[0];
$lat = $data->Placemark[0]->Point->coordinates[1];
return ($long);
}else{
return false;
}
}
?>
<?php
$zip = $_GET['zip'];
$radius = $_GET['radius'];
$term = $_GET['term'];
?>
<?php
$lat = getLat($zip);
$long = getLong($zip);
?>
<?php
$search = new TwitterSearch($term);
$results = $search->rpp(500)->contains($term)->geocode($lat, $long, 25)->results();
foreach($results as $res){
echo '<img src="'.$res->profile_image_url.'">';
echo $res->text.'<br />';
}