<?php /* Primary router for the API */ include __DIR__ . '/../../inc/all.php'; //Create instance of IO and extract request variables $io = new IO(); $verb = $_SERVER['REQUEST_METHOD']; switch ($verb) { case "POST": $args = $io->extractVariables(INPUT_POST); break; default: $args = $io->extractVariables(INPUT_GET); } //Preare results array and prepare path $results = []; $results["meta"]["ok"] = true; $path = explode('/', ltrim($_SERVER['PATH_INFO'], "/")); switch ($path[0]) { case "events": $eventIO = new EventIO($io); //Get eventId if (isset($path[1]) && trim($path[1]) != "") { $args["eventId"] = $path[1]; } switch ($verb) { case "GET": $results = $eventIO->getEvents($args); break;