summaryrefslogtreecommitdiffstats
path: root/examples/server/index.php
blob: 5416eb9b9d1a81bcd6dc70001b323ccba5c277bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

require_once __DIR__ . '/../../vendor/autoload.php';
require_once 'MySSOServer.php';

$ssoServer = new MySSOServer();
$command = isset($_REQUEST['command']) ? $_REQUEST['command'] : null;

if (!$command || !method_exists($ssoServer, $command)) {
    header("HTTP/1.1 404 Not Found");
    header('Content-type: application/json; charset=UTF-8');
    
    echo json_encode(['error' => 'Unknown command']);
    exit();
}

$result = $ssoServer->$command();