PHP code example of osumionline / plugin-token
1. Go to this page and download the library: Download osumionline/plugin-token library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
osumionline / plugin-token example snippets
$tk = new OToken("1234bf577a76645dbabcdbc379998243ac1c1234");
$tk->addParam('id', $id);
$tk->addParam('name', $name);
$tk->addParam('email', $email);
$tk->addParam('exp', time() + (24 * 60 * 60));
$token = $tk->getToken();
$tk = new OToken("1234bf577a76645dbabcdbc379998243ac1c1234");
if ($tk->checkToken($headers['Authorization'])) {
$id = $tk->getParam('id');
$name = $tk->getParam('name');
$email = $tk->getParam('email');
}
else {
echo "ERROR: El token no es válido."
}