Exemplo n.º 1
0
function convert_xml($xml_result, $what)
{
    global $xml_dir, $xml_name;
    error_reporting(E_ALL & ~E_DEPRECATED & ~E_WARNING & ~E_NOTICE & ~E_STRICT);
    $now = date('_Y.m.d_h-i-s_A_');
    //  current date and time , but writeable as file name on all OS
    //  convert the result array to XML file
    $array2XML = new Array2xml();
    $array2XML->setArray($xml_result);
    //  store the online XML result
    if ($array2XML->saveArray("" . $xml_dir . "/" . $what . "_" . $xml_name . "", "" . $what . "_results")) {
    } else {
        if ($debug == '2') {
            echo "<small>Attention: Unable to create the XML result file <span class='blue'>{$xml_name}</span> in subfolder <span class='blue'>{$xml_dir}</span></small><br />";
        }
    }
    //  store the XML cached result
    if ($array2XML->saveArray("" . $xml_dir . "/stored/" . $now . "" . $what . "_" . $xml_name . "", "" . $now . "" . $what . "_results")) {
    } else {
        if ($debug == '2') {
            echo "<small>Attention: Unable to create the XML cache result file <span class='blue'>{$xml_name}</span> in subfolder <span class='blue'>{$xml_dir}</span></small><br />";
        }
    }
    return;
}
Exemplo n.º 2
0
 /**
  * converts PHP array into XML
  *
  * @param $result  php array
  * @return xml
  * @access public
  */
 function arrayToXML($result)
 {
     if (is_array($result)) {
         $array2XML = new Array2xml();
         $array2XML->setArray($result);
         return $array2XML->saveArray("Result");
     } else {
         return "<?xml version='1.0' encoding='utf-8'?><error>ERROR: server behaved unexpectedly !!</error>";
     }
 }
Exemplo n.º 3
0
 function arrayToXML($result)
 {
     $array2XML = new Array2xml();
     $array2XML->setArray($result);
     return $array2XML->saveArray("Result");
 }