diff --git a/auth.php b/auth.php
new file mode 100644
index 0000000..4722178
--- /dev/null
+++ b/auth.php
@@ -0,0 +1,57 @@
+ $code,
+ 'client_id' => $client_id,
+ 'redirect_uri' => $redirect_uri,
+ 'grant_type' => 'authorization_code'
+ );
+
+ // Выполнение POST запроса для получения токена
+ $options = array(
+ 'http' => array(
+ 'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
+ 'method' => 'POST',
+ 'content' => http_build_query($data),
+ ),
+ );
+
+ $context = stream_context_create($options);
+ $result = file_get_contents($token_url, false, $context);
+
+ if ($result === FALSE) {
+ die('Ошибка при получении токена');
+ }
+
+ $response = json_decode($result, true);
+
+ if (isset($response['error'])) {
+ die('Ошибка: ' . $response['error_description']);
+ }
+
+ $access_token = $response['access_token'];
+
+ echo "Ваш access token: " . $access_token;
+}
+?>
+
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..11fb100
--- /dev/null
+++ b/index.php
@@ -0,0 +1,60 @@
+Баланс вашего кошелька: ' . $balance . ' руб.';
+
+// Получаем историю операций (последние 5 операций)
+$params = array(
+ 'records' => 5,
+);
+$operationHistory = apiRequest($operationHistoryUrl, $token, $params);
+
+// Выводим последние 5 операций
+echo 'Последние 5 операций:
';
+foreach ($operationHistory['operations'] as $operation) {
+ echo 'Дата: ' . $operation['datetime'] . '
';
+ echo 'Сумма: ' . $operation['amount'] . ' руб.
';
+ echo 'Тип: ' . $operation['title'] . '
';
+ echo 'Описание: ' . $operation['message'] . '
';
+ echo '
';
+}
+?>