vk/system/API/CallBack.php

48 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace VK\API;
class CallBack extends CallBackAbstract
{
/**
* Адрес для создания колбек-сервера
*
* @var string
*/
private $url;
/**
* Пользовательский ключ колбек-сессии
*
* @var string
*/
private $secret_key;
/**
* Ключ подтверждения колбек сессии
*
* @var string
*/
private $confirmation_token;
/**
* @var int
*/
private $group_id;
public function __construct(object $group, array $params = []){
$this->secret_key = $_ENV['CALLBACK_SECRET_KEY'];
$this->url = $_ENV['SERVER_DOMAIN'];
$this->group_id = $group->id;
$this->group_id->request('groups.addCallbackServer', [
'group_id' => $this->group_id,
'url' => $this->url,
'title' => $this->group_id . 'CallBackServer',
'secret_key' => $this->secret_key
]);
$this->confirmation_token = request('groups.getCallbackConfirmationCode', [$this->group_id]);
Curl::post($vk, [$this->confirmation_token]);
}
}