<?php
/*
 * Created on 2011-12-27
 *by 月下幽杳@www.vvfox.com
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 error_reporting(0);
header("Content-type: text/xml; charset=utf-8");
function vvfox($hash) {
	 $key  = $hash."kgcloud";
     $key= md5($key);
//  $songurl="http://tracker2.kugou.com/i/?hash=$hash&key=$key&cmd=3";
	$songurl = "http://tracker1.kugou.com/i/?hash=$hash&cmd=3&key=$key";
	$str = iconv('gbk','utf-8',file_get_contents($songurl));
//	preg_match('|"url":"([^"]+)","fileSize|', $str, $ar);
	$object = $json_decode($str);
	$linkurl = $object->url;
	header("location:$linkurl");
}
if (isset ($_GET['hash'])) {
	vvfox($_GET['hash']);
}
?>
