'; echo "HTTP Status Code: $http_code\n"; print_r($response); // Display the structured response echo ''; $switch_groups = []; // Initialize an empty array to hold switch groups // Check if 'items' exist in the response if (isset($response['items']) && is_array($response['items'])) { foreach ($response['items'] as $item) { $groupName = $item['group']; // Get the group name $typeValue = $item['type']; // Get the type value or description // Store group and type in the switch_groups array if (!isset($switch_groups[$groupName])) { $switch_groups[$groupName] = []; // Initialize an array for this group } $switch_groups[$groupName][] = $typeValue; // Append the type (or description) to the group } } // Debug output (optional) echo '
'; print_r($switch_groups); // To see the structured data echo ''; ?>