1. Go to this page and download the library: Download upmind/hexonet-php-sdk 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/ */
upmind / hexonet-php-sdk example snippets
$cl = new \HEXONET\APIClient();
$cl->useOTESystem()//LIVE System would be used otherwise by default
->useHighPerformanceConnectionSetup()//Default Connection Setup would be used otherwise by default
->setCredentials("test.user", "test.passw0rd");
$r = $cl->request(["COMMAND" => "StatusAccount"]);
$cl = new \HEXONET\APIClient();
$cl->useOTESystem()//LIVE System would be used otherwise by default
->enableDebugMode()//activate debug outputs
->setCustomLogger(new MyCustomerLogger())//provide your mechanism here
->setCredentials("test.user", "test.passw0rd");
$r = $cl->request(["COMMAND" => "StatusAccount"]);
$cl = new \HEXONET\APIClient();
$cl->useOTESystem()//LIVE System would be used otherwise by default
->setCredentials("test.user", "test.passw0rd");
$r = $cl->login();
// or this line for using 2FA
// $r = $cl->login('.. here your otp code ...');
if ($r->isSuccess()){
echo "LOGIN SUCCEEDED.<br/>";
// Now reuse the created API session for further request
// You don't have to care about anything!
$r = $cl->request(array(
"COMMAND" => "StatusAccount"
));
echo "<pre>" . htmlspecialchars(print_r($r->getHash(), true)) . "</pre>";
// Perform session close and logout
$r = $cl->logout();
if ($r->isSuccess()){
echo "LOGOUT SUCCEEDED.<br/>";
} else {
echo "LOGOUT FAILED.<br/>";
}
}
else {
echo "LOGIN FAILED.<br/>";
}
// right after successful login
$cl->saveSession($_SESSION);
// for every further request
$cl->reuseSession($_SESSION);
// --- SESSIONLESS API COMMUNICATION ---
$cl = new \HEXONET\APIClient();
$cl->useOTESystem()//LIVE System would be used otherwise by default
// ->setRemoteIPAddress("1.2.3.4:80"); // provide ip address used for active ip filter
->setCredentials("test.user", "test.passw0rd");
$r = $cl->request(array(
"COMMAND" => "StatusAccount"
));
echo "<pre>" . htmlspecialchars(print_r($r->getHash(), true)) . "</pre>";