109 protected static function Execute($operation, $params = array())
111 $params[
'operation'] = $operation;
114 $params[
'key'] = $license->getPublicHashKey();
115 $params[
'keysign'] = $license->getHashLicenseKey();
116 $params[
'host']= \Bitrix\Main\Config\Option::get(
'intranet',
'portal_url',
null);
118 if (!$params[
'host'])
120 $params[
'host']= \Bitrix\Main\Config\Option::get(
123 $_SERVER[
'HTTP_HOST']
127 if (!$params[
'host'])
129 $params[
'host'] = $_SERVER[
'HTTP_HOST'];
132 $params[
'host'] = trim($params[
'host']);
135 mb_strpos($params[
'host'],
'http://') === 0 ||
136 mb_strpos($params[
'host'],
'https://') === 0
139 $parseHost = parse_url($params[
'host']);
140 if (isset($parseHost[
'host']))
142 $params[
'host'] = $parseHost[
'host'];
143 if (isset($parseHost[
'port']))
145 $params[
'host'] .=
':' . $parseHost[
'port'];
150 if (!isset($params[
'lang']) || !$params[
'lang'])
152 unset($params[
'lang']);
155 $httpClient = new \Bitrix\Main\Web\HttpClient(array(
156 'socketTimeout' => 5,
157 'streamTimeout' => 30
160 $httpClient->setHeader(
'User-Agent',
'Bitrix24 Sites');
161 $answer = $httpClient->post(
'https://pub.bitrix24.site/pub.php', $params);
164 if ($answer && $httpClient->getStatus() ==
'200')
166 $result = $httpClient->getResult();
173 $result = \Bitrix\Main\Web\Json::decode($result);
180 if ($result[
'result'] ===
'Bad license')
185 return $result[
'result'];