-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest2_collection.php
54 lines (47 loc) · 1.01 KB
/
test2_collection.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
<?php
switch($_SERVER['REQUEST_METHOD']) {
case "POST":
if ($input = file_get_contents("php://input")){
//test for json
if ($json_post = json_decode($input,true)){
var_dump( $json_post ); // associative array
echo "Write collection to database";
}
}
break;
case "GET":
$members = array(
array(
'id' => 1,
'name' => '',
'status' => 'will attend',
'tickets' => 10,
'email' => '[email protected]',
'type' => 'gold'
),
array(
'id' => 2,
'name' => 'Pietje',
'status' => 'will attend',
'tickets' => 10,
'email' => '[email protected]',
'type' => 'gold'
),
array(
'id' => 3,
'name' => 'Pietje',
'status' => 'will attend',
'tickets' => 10,
'email' => '[email protected]',
'type' => 'gold'
)
);
header('Content-type: application/json');
echo json_encode($members);
die();
break;
}
//header(':', true, 400);
//header('X-PHP-Response-Code: 404', true, 400);
return false;
?>