You are here

function shurly_service_output_xml in ShURLy 8

Same name and namespace in other branches
  1. 6 shurly_service/shurly_service.inc \shurly_service_output_xml()
  2. 7 shurly_service/shurly_service.inc \shurly_service_output_xml()

Output xml data.

File

shurly_service/shurly_service.inc, line 151
Link general search functionalities to services module.

Code

function shurly_service_output_xml($data) {
  $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><data />");
  if (is_array($data)) {
    foreach ($data as $key => $value) {
      $value = htmlentities($value);
      $xml
        ->addChild($key, $value);
    }
  }
  $output = $xml
    ->asXML();
  header('Connection: close');
  header('Content-Length: ' . strlen($output));
  header('Content-Type: text/xml');
  header('Date: ' . date('r'));
  print $output;
}