getTaoStop.php 672 Bytes
<?php

  $taoroot = getenv("TAOROOT");
 
  // Tao stop from regular OMNI Input
  if (getenv("sw_vi") == 'ace_swepam_real')
    $taopath = $taoroot.'/SW';
  else 
    $taopath = getenv('TAOPATH');

  $file = $taopath.'/sw_info.xml';
  if (!file_exists($file)) exit('ERROR');

  $xml = new DomDocument('1.0');
  if (!$xml->load($file)) exit('ERROR');

  $time = $xml->getElementsByTagName('GlobalStop');
  if ($time->length == 0) exit('ERROR');

  $timeValue = $time->item(0)->nodeValue;

  // if new data or error set take this year
  if ($timeValue == '' || $timeValue == '1970-01-01T::.Z')
    $timeValue=date('Y',time()).'-01-01T00:00:00.000Z';

  exit($timeValue);

?>