虾米音乐小偷

<?php
function http($url){
	set_time_limit(0);
	$result=file_get_contents($url);
	if($result===false){
		$curl=curl_init();
		curl_setopt($curl,CURLOPT_URL,$url);
		curl_setopt($curl,CURLOPT_HEADER,false);
		curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
		$result=curl_exec($curl);
		curl_close($curl);
	}
	if(empty($result)){
		$result=false;
	}
	return $result;
}
function xiami($location){
    $count = (int)substr($location, 0, 1);
    $url = substr($location, 1);
    $line = floor(strlen($url) / $count);
    $loc_5 = strlen($url) % $count;
    $loc_6 = array();
    $loc_7 = 0;
    $loc_8 = '';
    $loc_9 = '';
    $loc_10 = '';
    while ($loc_7 < $loc_5){
        $loc_6[$loc_7] = substr($url, ($line+1)*$loc_7, $line+1);
        $loc_7++;
    }
    $loc_7 = $loc_5;
    while($loc_7 < $count){
        $loc_6[$loc_7] = substr($url, $line * ($loc_7 - $loc_5) + ($line + 1) * $loc_5, $line);
        $loc_7++;
    }
    $loc_7 = 0;
    while ($loc_7 < strlen($loc_6[0])){
        $loc_10 = 0;
        while ($loc_10 < count($loc_6)){
            $loc_8 .= @$loc_6[$loc_10][$loc_7];
            $loc_10++;
        }
        $loc_7++;
    }
    $loc_9 = str_replace('^', 0, urldecode($loc_8));
    return $loc_9;
}

?>

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="虾米小偷" />
<meta name="keywords" content="虾米小偷" />
<meta name="description" content="虾米小偷" />
<title>虾米小偷</title>
</head>
<body>
<?php
if(isset($_SERVER["QUERY_STRING"])){
	if(empty($_SERVER["QUERY_STRING"])){
		$_SERVER["QUERY_STRING"]=1769052446;
	}
	$content=http('http://www.xiami.com/widget/xml-single/sid/'.$_SERVER["QUERY_STRING"]);
	preg_match_all("/<album_cover><\!\[CDATA\[([^\]].*)\]\]><\/album_cover>/i",$content,$image);
	preg_match_all("/<song_name><\!\[CDATA\[([^\]].*)\]\]><\/song_name>/i",$content,$name);
	preg_match_all("/<artist_name><\!\[CDATA\[([^\]].*)\]\]><\/artist_name>/i",$content,$art);
	preg_match_all("/<location><\!\[CDATA\[([^\]].*)\]\]><\/location>/i",$content,$location);
    $old=xiami($location[1][0]);
    $old2=explode("?",$old);
    $new=str_replace("m5","m1",$old2[0]);
	echo "<table><tr><td><img style='float:left;border:1px solid #eee;padding:2px;' src='".$image[1][0]."' /><td>";
	echo "<td><span style='font-family:Microsoft Yahei;font-size:50px;'>".$name[1][0]." - ".$art[1][0]."</span>";
	echo "<br />";
	#echo "<span style='font-family:Microsoft Yahei;font-size:10px;border-radius:2px;background:#88c;padding:5px 8px;color:#fff'>".$old."</span>";
    echo "<span style='font-family:Microsoft Yahei;font-size:10px;border-radius:2px;background:#019875;padding:5px 8px;color:#fff'>".$new."</span></td></tr></table>";
}
?>
<div style='position:fixed;bottom:0;left:0;width:100%;font-family:Microsoft Yahei;font-size:10px;background:#019875;padding:8px;color:#fff'>
使用方法:在本页面地址后面加上虾米音乐ID!如:http://jinzhe.net/tools/xiami.php?1772322939
</div>
</body>
</html>


你可能感兴趣的:(虾米)