PHP code for saving remote files to the server (including using getid3 to retrieve audio file attributes) & lt; metacharset = UTF-8/& gt; & lt; forpolichod = "post" & gt; & lt; inputname = "url" size = "50" value = "http://www.mgyyw.c PHP for saving remote files to server code (including using getid3 to retrieve audio file properties)
// Require ('audioexif. class. php ');
// $ AE = new AudioExif ([$ charset = 'gbk']);
// $ File = '/path/to/test10000 ';//
// 1. check whether the file is complete (only for wma, mp3 always returns true )//
// $ AE-> CheckSize ($ file );//
// 2. read information. the returned value is an array composed of information. for key name explanations, see the above //
// Print_r ($ AE-> GetInfo ($ file ));//
// 3. write information. The second parameter is a hash array, key-> value. For more information, see the preceding section. mp3 also supports Track.
// Requires that the file path of the first parameter can be written by the program
// $ Pa = array ('title' => 'New title', 'albumtitle' => 'New album name ');
// $ AE-> SetInfo ($ file, $ pa );//
If ($ _ POST ['getid3']) {
Require_once ('./getID3/getid3/getid3.php ');
$ GetID3 = new getID3;
$ FileInfo = $ getID3-> analyze ('temp/101.wma ');
Echo 'playback Time: '. $ FileInfo ['Playtime _ string'].'
';
Echo 'file size: '. $ FileInfo ['filesize'].'
';
Echo 'file name: '. $ FileInfo ['filename'].'
';
Echo 'file suffix: '. $ FileInfo ['Audio'] ['dataformat'].'
';
Echo 'Question: '. $ FileInfo ['tags'] ['asf'] ['alipay'] [0].'
';
Echo 'Songs: '. $ FileInfo ['tags'] ['asf'] ['artlist'] [0].'
';
Echo 'Ratio: '. round ($ FileInfo ['Audio'] ['bitrate']/). 'kbps
';
Print ("
");
print_r($FileInfo);
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 );
}
?>