pastebin

Paste Search Dynamic
Recent pastes
remotefilename
  1. <?php
  2. $remotefilename = 'http://www.example.com/filename.mp3';
  3. if ($fp_remote = fopen($remotefilename, 'rb')) {
  4.         $localtempfilename = tempnam('/tmp', 'getID3');
  5.         if ($fp_local = fopen($localtempfilename, 'wb')) {
  6.                 while ($buffer = fread($fp_remote, 32768)) {
  7.                         fwrite($fp_local, $buffer);
  8.                 }
  9.                 fclose($fp_local);
  10.  
  11.                 $remote_headers = array_change_key_case(get_headers($remotefilename, 1), CASE_LOWER);
  12.                 $remote_filesize = (isset($remote_headers['content-length']) ? (is_array($remote_headers['content-length']) ? $remote_headers['content-length'][count($remote_headers['content-length']) - 1] : $remote_headers['content-length']) : null);
  13.  
  14.                 // Initialize getID3 engine
  15.                 $getID3 = new getID3;
  16.  
  17.                 $ThisFileInfo = $getID3->analyze($localtempfilename, $remote_filesize, basename($remotefilename));
  18.  
  19.                 // Delete temporary file
  20.                 unlink($localtempfilename);
  21.         }
  22.         fclose($fp_remote);
  23. }
  24. ?>
Parsed in 0.024 seconds