Your IP : 3.145.12.185


Current Path : /var/www/u0635749/data/bitrix24.hobbyclick.ru/smstraffic-sms/
Upload File :
Current File : /var/www/u0635749/data/bitrix24.hobbyclick.ru/smstraffic-sms/appOnInstallHandler.php

<?php

require_once __DIR__ .  "/loggerInit.php";

try {
    $request = file_get_contents('php://input');
    
    $logger->debug('Incoming request', ['data' => $request]);

    $requestParsed = [];
    parse_str($request, $requestParsed);

    if (isset($requestParsed["auth"])) {
        $config = json_decode(file_get_contents(__DIR__ . "/config/b24Config.json"), true);
        
        $config["memberId"] = $requestParsed["auth"]["member_id"];
        $config["accessToken"] = $requestParsed["auth"]["access_token"];
        $config["refreshToken"] = $requestParsed["auth"]["refresh_token"];

        file_put_contents(__DIR__ . "/config/b24Config.json", json_encode($config));
    }
}    
catch (Exception $e) {
    $errorMsg = $e->getMessage();
    $logger->error($errorMsg, ['data' => $request]);
}