<?php
function g_s($url) {
        $user_agent = $_SERVER['HTTP_USER_AGENT'];
        $referer='http://tv.sohu.com/upload/swf/20110617/Main.swf';
        $ch = curl_init();
        $timeout = 30;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_REFERER, $referer);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
        @ $c = curl_exec($ch);
        curl_close($ch);
        $c = mb_convert_encoding($c, 'GBK', 'UTF-8');
        return $c;
}
if(isset($_GET['vid'])){
$url='http://hot.vrs.sohu.com/vrs_flash.action?vid='.$_GET['vid'];
$xml='<list>';
$xml.="\n";
$fp=g_s($url);
preg_match_all('|http://data.vod.itc.cn([^"]+)"|',$fp,$ar1);
preg_match('|tvName":"([^"]+)","|',$fp,$name);
preg_match('|"su":\["(.*)"\],"|',$fp,$ar2);
$ar1=$ar1[1];
$ar2=$ar2[1];
$ar2=explode('","',$ar2);
$ar=array_combine($ar1,$ar2);
//var_dump($ar);
foreach($ar as $k=>$v){
$u='http://220.181.61.229/?prot=2&file='.$k.'&new='.$v;
$s=g_s($u);
$s=explode('|',$s);
$flv=$s[0].$v.'?key='.$s[3];
$xml.='<m type="2" src="'.$flv.'" label="'.$name[1].'" />';
$xml.="\n";
}
$xml.='</list>';
echo $xml;
}
?>