function health_health_api_callback_xml in Health Status 7
Implements hook_health_api_callback_METHOD().
Returns data as XML.
File
- ./
health.service.inc, line 36 - Contains functions related to getting/showing data in the API.
Code
function health_health_api_callback_xml($data) {
$xml = new SimpleXMLElement("<health></health>");
$groups = $xml
->addChild("groups");
foreach ($data as $gr => $results) {
$group = $groups
->addChild("group");
$group
->addAttribute("name", $gr);
$monitors = $group
->addChild("monitors");
foreach ($results as $key => $r) {
$m = $monitors
->addChild("monitor");
$m
->addAttribute("name", $key);
$m
->addChild("status", $r['status']);
$m
->addChild("message", $r['message']);
}
}
return $xml
->asXML();
}