summaryrefslogtreecommitdiffstats
path: root/examples/server/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'examples/server/index.php')
-rw-r--r--examples/server/index.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/examples/server/index.php b/examples/server/index.php
index d68c55e..5416eb9 100644
--- a/examples/server/index.php
+++ b/examples/server/index.php
@@ -1,19 +1,18 @@
<?php
require_once __DIR__ . '/../../vendor/autoload.php';
-require_once __DIR__ . '/SSOTestServer.php';
+require_once 'MySSOServer.php';
-$sso = new SSOTestServer();
-$request = isset($_REQUEST['command']) ? $_REQUEST['command'] : null;
+$ssoServer = new MySSOServer();
+$command = isset($_REQUEST['command']) ? $_REQUEST['command'] : null;
-if (!$request || !method_exists($sso, $request)) {
- error_log('Unkown command');
- header("HTTP/1.1 406 Not Acceptable");
+if (!$command || !method_exists($ssoServer, $command)) {
+ header("HTTP/1.1 404 Not Found");
header('Content-type: application/json; charset=UTF-8');
-
- echo "{error: 'Uknown command'}";
- die;
+
+ echo json_encode(['error' => 'Unknown command']);
+ exit();
}
-$sso->$request();
+$result = $ssoServer->$command();