1. Go to this page and download the library: Download taktik/php-lib-registr 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/ */
taktik / php-lib-registr example snippets
$fp = fopen('php://input', 'r');
$f = json_decode(stream_get_contents($fp), true);
/* JSON example
{
"user:": {
"uid": "e7urzbVMhIf2TwywnzusCN9YesBghB2ywofzPwiMJG4RATvlayHKaQvT5a8INF4XYXWncs2Rb6cbPyzaMe8iU5QQwJENRrKPmJ9RpMtcCDRRQNTzE1FdcPnNcZB9O02q",
"email": "[email protected]",
"phone": "123456789",
"gender": 1,
"firstname": "John",
"lastname": "Johnson",
"degreeBefore": "Mgr.",
"degreeAfter": "DiS."
}
}
*/
if ($f['user']['uid'] > '') {
//do action for user update, example:
mysqli_query('UPDATE user SET ? WHERE uid = ? ', $f['user'], $f['user']['uid']);
}
if ($f['school']['uid'] > '') {
//do action for school update, example:
mysqli_query('UPDATE school SET ? WHERE uid = ? ', $f['school'], $f['school']['uid']);
}
$conf = [
'secret_key' => 'YOUR_SECRET_KEY',
'x_taktik_token' => 'YOUR_X_TAKTIK_TOKEN'
];
$api = new TaktikRegistr\TaktikRegistr($conf);
$user = $api->user()->login('login', 'password');
//You can save it to cookie, for later use.
setcookie("user_token", $user->getToken(), $user->getExpiration(), "/");