مطمئن نیستم که درست کار کنه... لطفا تستش کنید!
function getSizeFile($url) {
if (substr($url,0,4)=='http') {
$x = array_change_key_case(get_headers($url, 1),CASE_LOWER);
if ( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) { $x = $x['content-length'];}
else { $x = $x['content-length']; }
}
else { $x = @filesize($url); }
return $x;
}
$pattern="#<a?[^/>]+href=['|\"](.*\.mp3)['|\"]?[^/>]+#";
preg_match_all($pattern,$bodytexts,$song);
$links = array();
foreach($song[1] as $music){
$ff = getSizeFile($music);
$ff = $ff/1024;
$ff = $ff/1024;
$size = mb_substr($ff, 0, 6, "utf8" );
$links[] = array(
'url' => $music,
'size' => $size
);
}
$i = 0;
$sizes = array();
foreach( $links as $key=>$link ){
$i++;
$sizes[$key] = $link['size'];
}
$min = min($sizes);
$min_key = array_keys($sizes, min($sizes));
$min_key = $min_key[0];
$max = max($sizes);
$max_key = array_keys($sizes, max($sizes));
$max_key = $max_key[0];
if($links != null)
{
$bodytext.= '<center><object data="'.$nukeurl.'includes/1.swf" height="50" id="dewplayer" name="dewplayer" type="application/x-shockwave-flash" width="300"><param name="wmode" value="transparent" /><param name="movie" value="dewplayer-rect.swf" /><param name="flashvars"
value="mp3='.$links[$min_key]['url'].'&autostart=0&autoreplay=0&showtime=1&volume=80" /></object></center>';
}