2023-05-09 22:45:56 +03:00

44 lines
1.2 KiB
PHP

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
/** @var CBitrixComponent $this */
/** @var array $arParams */
/** @var array $arResult */
/** @var string $componentPath */
/** @var string $componentName */
/** @var string $componentTemplate */
/** @global CDatabase $DB */
/** @global CUser $USER */
/** @global CMain $APPLICATION */
use Bitrix\Main\Context,
Bitrix\Main\Type\DateTime,
Bitrix\Main\Loader,
Bitrix\Iblock;
if(!empty($arParams['CITY']['LEADER_CRM_ID']))
{
$c = curl_init();
curl_setopt($c, CURLOPT_URL, API_HOST . "/site/GetBusinessUnitInfo?code=" . $arParams['CITY']['LEADER_CRM_ID']);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($c, CURLOPT_TIMEOUT, 30);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$response = curl_exec($c);
//print "<!-- TEAMTEAMTEAM";
//print_r($response);
//print "-->";
$httpcode = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
$arResult['LEADER'] = [];
if($httpcode === 200)
{
$arResult['LEADER'] = json_decode($response, true);
}
}
$this->IncludeComponentTemplate();