PHP Script Extracts mp3 content from HTML Page

A simple PHP program developed after my graduation. This script is mainly intended to extract mp3 links from an HTML page.

Core components of this program are using mime types (‘mp3′,’qt’,’mov’)

 <script type="text/javascript" src="https://mediaplayer.yahoo.com/js"></script>  
 <?php  
 if(!function_exists('mimecontent_type')) {  
   function mimecontent_type($filename) {  
     $mime_types = array(  
       'txt' => 'text/plain',  
       'htm' => 'text/html',  
       'html' =>'text/html',  
       'php' => 'text/html',           
       'xml' => 'application/xml',  
       // audio/video  
       'mp3' => 'audio/mpeg',  
       'qt' => 'video/quicktime',  
       'mov' => 'video/quicktime',  
     );  
     $ext = strtolower(array_pop(explode('.',$filename)));  
     if (array_key_exists($ext, $mime_types)) {  
       return $mime_types[$ext];  
     }  
     elseif (function_exists('finfo_open')) {  
       $finfo = finfo_open(FILEINFO_MIME);  
       $mimetype = finfo_file($finfo, $filename);  
       finfo_close($finfo);  
       return $mimetype;  
     }  
     else {  
       return 'application/octet-stream';  
     }  
   }  
 }  
 ?>  
 <?php  
 include 'simple_html_dom.php';  
 $url=$_REQUEST['url'];  
 //$url="http://www.example.info/music-mp3/download/%20New%20Songs%20(%202009%20)/AYAN/";  
 $html = file_get_html($url);   
 $basetype=mimecontent_type(basename($url));  
 if(($basetype=="text/html")||($basetype=="text/plain"))  
 {  
  foreach($html->find('a') as $element)  
  {  
   $basefile=basename($element->href);  
   $type=mimecontent_type($basefile);  
   if($type=="audio/mpeg")  
   {  
     echo "<a href='$element->href'>".$element->href."<br>";  
   }  
  }  
 }  
 else  
 {  
  foreach($html->find('a') as $element)  
  {  
   $basefile=basename($element->href);  
   $type=mimecontent_type($basefile);  
   if($type=="audio/mpeg")  
   {  
     echo "<a href='$url$element->href'>".$element->href."<br>";  
   }  
  }  
 }  
 ?>  

A simple demo using a query string method.