Add street autocomplete API
This commit is contained in:
parent
8c20a29057
commit
dd161cc7f2
@ -26,6 +26,13 @@ $APIS = [
|
||||
"longitude" => "/\-?[0-9]{1,3}(\.[0-9]{0,10})?/"
|
||||
]
|
||||
],
|
||||
"gis/streetautocomplete" => [
|
||||
"load" => "gis.streetautocomplete.php",
|
||||
"vars" => [
|
||||
"street" => "",
|
||||
"zip" => ""
|
||||
]
|
||||
],
|
||||
"gis/fixphrase" => [
|
||||
"load" => "gis.fixphrase.php",
|
||||
"vars" => [
|
||||
|
16
endpoints/gis.streetautocomplete.php
Normal file
16
endpoints/gis.streetautocomplete.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
$resultjson = file_get_contents("http://192.168.130.22/?zip=" . $VARS["zip"] . "&address=" . $VARS["street"]);
|
||||
|
||||
$results = json_decode($resultjson, true);
|
||||
if ($results["status"] != "OK") {
|
||||
exitWithJson($results);
|
||||
}
|
||||
|
||||
exitWithJson(["status" => "OK", "results" => $results["results"]]);
|
Loading…
x
Reference in New Issue
Block a user