-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoogle.php
55 lines (42 loc) · 1.31 KB
/
Google.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
<?php
require_once 'setters.php';
require_once 'gmaps.php';
final class Google extends setters
{
public function Geocode()
{
$this->url = 'https://maps.googleapis.com/maps/api/geocode/json?';
switch (TRUE)
{
case (!empty($this->lat) && !empty($this->lng)):
$this->url .= 'latlng='.$this->lat.','.$this->lng;
break;
case (!empty($this->address)):
$this->url .= 'address='.$this->address;
break;
}
$this->url .= '&sensor='.$this->sensor
.'&key='.$this->apiKey;
return $this->getData();
}
public function Geolocation()
{
$this->url = 'https://www.googleapis.com/geolocation/v1/geolocate?'
.'query='.$this->query
.'&key='.$this->apiKey;
return $this->getData();
}
public function searchPlace()
{
$this->url = 'https://maps.googleapis.com/maps/api/place/textsearch/json?'
.'query='.$this->query
.'&sensor='.$this->sensor
.'&radius='.$this->radius
.'&key='.$this->apiKey;
return $this->getData();
}
public static function Maps($key)
{
return new Map($key);
}
}