-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestApi.php
More file actions
35 lines (19 loc) · 814 Bytes
/
testApi.php
File metadata and controls
35 lines (19 loc) · 814 Bytes
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
<?php
require_once("ApiFrame.class.php"); //Import ApiFrame script
$frame = new Frame();//Init a new instance
$frame->Start();//Frame starten
$frame->enableErrorReporting(false);//Globale errors abfangen, Parameter nur true wenn auch errors abgefangen werden sollen, ohne nur FatalErrors und exceptions
/**
This commtent defines a test API method
@get api/{id:"/^[0-9]*$/"}/{name}
@param text method="get"
*/
function testAPI($id,$name,$text,$frameObject)
{
$frame = Frame::get($frameObject);
$arr = array("id"=>$id,"name"=>$name,"text"=>$text);
$frame->output($arr);
$frame->setHttpStatusCode(200);
}
$frame->handleApiUrls(__FILE__,$_GET["__url"]);//Behandle API urls benutze für die URL zuordnung den angegebenen GET Parameter [htaccess redirect]
?>