You are here

function shurly_service_output_xml in ShURLy 6

Same name and namespace in other branches
  1. 8 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 171
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;
}