<?php
function g_s($url) {
        $user_agent = $_SERVER['HTTP_USER_AGENT'];
        $ch = curl_init();
        $timeout = 30;
        curl_setopt($ch, CURLOPT_URL, $url);
        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);
       
        return $c;
}
$xml = '<list>';
$xml .= "\n";
$filename = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["SCRIPT_NAME"];
if (isset ($_GET['vod'])) {
 $url = file_get_contents('http://biz.vsdn.tv380.com/playlive.php?'.$_GET['vod']);
  $url= str_replace('" />','+',$url);
  $url= str_replace('rtmp://','http://',$url);
$addresstemp = strstr($url,"http://");
$address = strtok($addresstemp,"+");
header("location:$address");


}
 else {
  $a = file_get_contents('http://live.tv189.com/index.php?r=index/indexL');
$a1 = explode('dl class="dlListJs"',$a);
$a = $a1[1];
$a= str_replace('</a>','""',$a);
$a = str_replace(array("'",")",'(','http://biz.vsdn.tv380.com/playlive.php?'),'',$a);
preg_match_all('/5B63686E(.*?);">/',$a, $m);
preg_match_all('/;">(.*?)""/',$a, $n);
$m=$m[1];
$n=$n[1];
$num=count($m);
for($o=0;$o<$num;$o++){
$nm=$m[$o];
@$newname = htmlspecialchars($n[$o], ENT_QUOTES);
@$newname = explode('&',@$newname);
@$newname = @$newname[0];		
$mn=str_split($nm,1);
$nm = explode(',',$nm);
$nm[0] = empty($nm[0])? '' :'<m type="2" label="'.$newname.' [高清]'.'" src="'.$filename.'?vod=5B63686E'. $nm[0].'"  />';
$nm[1] = empty($nm[1])? '' : '<m type="2" label="'.$newname.' [标清]'.'" src="'.$filename.'?vod='.$nm[1].'"  />';
$nm=$nm[0]."
".$nm[1] ;
$xml .= $nm ;
$xml.= "\n";
}
    
        }

$xml .= '</list>';

echo $xml;  
?>
