$filters = array(); foreach ($result as $i => $row) { $filters[$i]['id'] = $row['id']; $filters[$i]['industry'] = $row['industry']; } header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('filters' => array('filter' => $filters))); exit; } if ($_POST['action'] == 'get_candidates') { $order_by = ''; if (isset($_POST['order_by'])) { $order_by = $_POST['order_by']; } $recommender = new Recommender($_POST['id']); $result = $recommender->get_recommended_candidates($order_by); if (count($result) <= 0 || is_null($result)) { echo '0'; exit; } if (!$result) { echo 'ko'; exit; } foreach ($result as $i => $row) { $result[$i]['member'] = htmlspecialchars_decode(html_entity_decode(stripslashes(desanitize($row['member'])))); } $response = array('candidates' => array('candidate' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit;