PHP saves remote files to server code (including using GETID3 to get audio file attributes)
Require (' AudioExif.class.php ');
$AE = new Audioexif ([$charset = ' GBK ']);
$file = '/path/to/test.mp3 ';//
1. Check that the file is complete (only for WMA, MP3 always returns TRUE)//
$AE->checksize ($file);//
2. Read the information, return the value of the array consisting of information, the key name explanation see above//
Print_r ($AE->getinfo ($file));//
3. Write information, the second parameter is a hash array, key-value, supported see above, MP3 also supports track
The file path that requires the first parameter can be written by this program
$pa = Array (' title ' = ' new title ', ' albumtitle ' = ' new album name ');
$AE->setinfo ($file, $PA);//
if (($_post[' getid3 ')) {
Require_once ('./getid3/getid3/getid3.php ');
$getID 3 = new GetID3;
$FileInfo = $getID 3->analyze (' temp/101.wma ');
Echo ' Play Time: '. $FileInfo [' playtime_string ']. '
';
echo ' File size: '. $FileInfo [' filesize ']. '
';
echo ' filename: '. $FileInfo [' filename ']. '
';
echo ' file suffix: '. $FileInfo [' Audio '] [' DataFormat ']. '
';
Echo ' title: '. $FileInfo [' tags '] [' asf '] [' album '][0]. '
';
Echo ' singer: ' $FileInfo [' tags '] [' asf '] [' Artist '][0]. '
';
echo ' bit rate: '. Round ($FileInfo [' Audio '] [' bitrate ']/1000,0). ' Kbps
';
Print ("
Print ("
");
}
if (($_post[' audioexif ')) {
Require (' AudioExif.class.php ');
$AE = new Audioexif ([$charset = ' GBK ']);
$file =$_post[' url '];
Echo $file;
echo $AE->checksize ($file);
Print_r ($AE->getinfo ($file));
}
Set_time_limit (24 * 60 * 60);
if (!isset ($_post[' submit ')) Die ();
folder to save downloaded files to. Must end with slash
$destination _folder = ' temp/';
$url = $_post[' url '];
$newfname = $destination _folder. BaseName ($url);
$file = fopen ($url, "RB");
if ($file) {
$NEWF = fopen ($newfname, "WB");
if ($NEWF)
while (!feof ($file)) {
Fwrite ($NEWF, Fread ($file, 1024 * 8), 1024 * 8);
}
}
if ($file) {
Fclose ($file);
Echo ' OK ';
}
if ($NEWF) {
Fclose ($NEWF);
}
?>