mojo_zero_web/api.php
2014-06-12 02:05:26 +02:00

20 lines
1.4 KiB
PHP

<?php
require_once 'system/autoload.inc.php'; //SYSTEM Classes
require_once 'mojotrollz/autoload.inc.php'; //Project Classes
require_once 'config.php'; //Server config
SYSTEM\system::start($mojotrollz_config); //Start System time + config
SYSTEM\system::include_ExceptionShortcut(); //allow ERROR() instead of \SYSTEM\LOG\ERROR()
SYSTEM\system::include_ResultShortcut(); //allow JsonResult() instead of \SYSTEM\LOG\JsonResult()
SYSTEM\system::register_errorhandler_dbwriter(); //write errors to database (must be first errorhandler to register)
SYSTEM\system::register_errorhandler_jsonoutput(); //print errors as json to caller
//Direct JSON Input
$json = json_decode(file_get_contents("php://input"), true);
if(!$json){
$json = array_merge($_POST,$_GET);}
//Construct the api with the dasense specific ApiVerfy Class and the call handler for da-sense api-calls ApiClass
//ApiClass contains all stuff you would seek in the index -> look there
echo \SYSTEM\API\api::run('\SYSTEM\API\verify', 'api_mojotrollz',$json);
new \SYSTEM\LOG\COUNTER("API was called sucessfully.");