<?php
require __DIR__ . '/../../vendor/autoload.php';
use opensrs\OMA\GenerateToken;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
require_once dirname(__FILE__) . '/../../opensrs/openSRS_loader.php';
// Put the data to the Formatted array
$callArray = array('user' => $_POST['user'], 'reason' => $_POST['reason'], 'attributes' => array('token' => $_POST['token'], 'duration' => $_POST['duration'], 'type' => $_POST['type'], 'oma' => $_POST['oma'] ? true : false));
// Open SRS Call -> Result
$response = GenerateToken::call($callArray);
// Print out the results
echo ' In: ' . json_encode($callArray) . '<br>';
echo 'Out: ' . $response;
} else {
// Format
if (isset($_GET['format'])) {
$tf = $_GET['format'];
} else {
$tf = 'json';
}
?>
<?php
include 'header.inc';
?>
<div class="container">
<h3>generate_token</h3>
<form action="" method="post" class="form-horizontal" >
<h4>Required</h4>
<div class="control-group">
<label class="control-label">User </label>