$queryUrl = 'сайт/вебхук/crm.livefeedmessage.add.json';
$queryData = http_build_query(array(
'fields' => array(
'POST_TITLE' => 'Заявка на консультацию: ',
'MESSAGE' => "Битрикс24 создан на базе платформы Bitrix Framework.",
'ENTITYTYPEID' => 1,
'ENTITYID' => intval($result['result']),
)
));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
if (CModule::IncludeModule("iblock")) {
$filter = [
'IBLOCK_ID' => 2,
];
$select = [
'NAME',
'SECTION_PAGE_URL',
];
$dbSection = CIBlockSection::GetList(
[
'LEFT_MARGIN' => 'ASC',
],
array_merge(
[
'ACTIVE' => 'Y',
'GLOBAL_ACTIVE' => 'Y',
],
is_array($filter) ? $filter : []
),
false,
array_merge(
[
'ID',
'IBLOCK_SECTION_ID',
],
is_array($select) ? $select : []
)
);
while ($arSection = $dbSection->GetNext(true, false)) {
$SID = $arSection['ID'];
$PSID = (int)$arSection['IBLOCK_SECTION_ID'];
$arLincs[$PSID]['CHILDS'][$SID] = $arSection;
$arLincs[$SID] = &$arLincs[$PSID]['CHILDS'][$SID];
}
$arResult['SECTIONS'] = array_shift($arLincs);
}