/
orte.php
executable file
·46 lines (38 loc) · 1.13 KB
/
orte.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
<?php
/* **************************************************
/ REST Webservice fuer Vereins Mitglieder Datenbank
/ created by Andreas Baierl, 09.02.2010
/
/
/ orte.php - get Listenressource: GET ".../strassen" (alle Strassen)
/ get Ressourcendetails: GET ".../strassen/1" (Details von Strasse 1)
/ create Ressource: POST ".../routen"
/
/* *************************************************/
require_once "includes.php";
$database = init_database();
$param = null;
if (isset($_GET['type'])) {
$type = $_GET['type'];
}
// Check for the path elements
$path = $_SERVER[PATH_INFO];
if ($path != null) {
$path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') { // GET Request
set_headers($type);
if ($path_params[1] != null) {
render_result(get_ort($path_params[1]),"orte",$type); // Ressourcendarstellung
} else {
render_result(get_orte(),"orte",$type); // Listenressource
}
}
/* not used
if ($_SERVER['REQUEST_METHOD'] == 'POST') { // POST Request
$input = file_get_contents("php://input");
render_result(create_route($input),null,$type); // create track entry and copy file
}
*/
mysql_close($database);
?>