Beispiel #1
0
function getID3($params)
{
    global $fileDir;
    // Initialize getID3 engine
    $getid3 = new getID3();
    $array2xml = new array2xml();
    // Tell getID3() to use UTF-8 encoding - must send proper header as well.
    $getid3->encoding = 'UTF-8';
    // Tell browser telling it use UTF-8 encoding as well.
    header("Content-type: text/xml");
    // Analyze file
    if (isset($params['file'])) {
        $file = $fileDir . $params["file"];
        try {
            $info = $getid3->Analyze($file);
            $array2xml->formatarray2xml($info);
            echo $array2xml->output;
        } catch (Exception $e) {
            die('An error occured: ' . $e->message);
        }
    } else {
        die("invalid file");
    }
}