$arSelect = [
"ID",
"NAME",
];
$arFilter = [
"IBLOCK_ID" => 2,
"ACTIVE"=>"Y",
];
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50), $arSelect);
while($ob = $res->GetNextElement())
{
$arFields[] = $ob->GetFields();
}