-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_php.php
More file actions
45 lines (36 loc) · 1.28 KB
/
verify_php.php
File metadata and controls
45 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
// Include exceptions first
require_once __DIR__ . '/src/Exceptions/HRDApiException.php';
require_once __DIR__ . '/src/Exceptions/HRDApiCommunicationException.php';
require_once __DIR__ . '/src/Exceptions/HRDApiIncorrectDataException.php';
require_once __DIR__ . '/src/Exceptions/HRDApiIncorrectDataReceivedException.php';
require_once __DIR__ . '/src/HRDApi.php';
use HRDBase\Api\HRDApi;
// Silence deprecation warnings
error_reporting(E_ALL & ~E_DEPRECATED);
$secrets = json_decode(file_get_contents(__DIR__ . '/secrets.json'), true);
if (!$secrets) {
die("Could not read secrets.json\n");
}
$login = $secrets['login'];
$password = $secrets['password'];
$apiKeyHex = $secrets['apiKeyHex'];
try {
echo "Initializing TestHRDApi...\n";
$apiInstance = HRDApi::getInstance([
'apiHash' => $apiKeyHex,
'apiLogin' => $login,
'apiPass' => $password,
'debug' => true,
]);
$token = $apiInstance->getToken();
echo "Attempting Login...\n";
echo "Login method finished.\n";
echo "Token: " . $token . "\n";
echo "Checking Partner Balance...\n";
$balance = $apiInstance->partnerGetBalance();
print_r($balance);
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
echo "Trace: " . $e->getTraceAsString() . "\n";
}