Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
14 | 2 | public function getGeo($place) : array |
|
15 | { |
||
16 | |||
17 | 2 | $url = "https://nominatim.openstreetmap.org/search.php?q=$place&polygon_geojson=1&format=jsonv2"; |
|
18 | 2 | $opts = array('http'=>array('header'=>"User-Agent: QingPanCleverAddressScript 3.7.6\r\n")); |
|
19 | 2 | $context = stream_context_create($opts); |
|
20 | // Open the file using the HTTP headers set above |
||
21 | 2 | $file = file_get_contents($url, false, $context); |
|
22 | |||
23 | |||
24 | 2 | $res = json_decode($file); |
|
25 | //var_dump($res); |
||
26 | 2 | return $res; |
|
27 | } |
||
29 |