<?php
$NameID = $_SERVER["QUERY_STRING"];
if (empty($NameID)) {echo "Service Unavailable";exit();}
if (strlen($NameID) < 5) {echo "Service Unavailable";exit();}
function getHTTPPage($url) {
if(!function_exists('curl_init')) {
return false;
} else {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$Referer_Url = "http://biz.vsdn.tv380.com/";
$timeout = 3;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt ($ch, CURLOPT_REFERER, $Referer_Url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$content = curl_exec($ch);
$errormsg = curl_error($ch);
curl_close($ch);
if($errormsg != '') {
echo $errormsg;
return false;
}
return $content;
}
}
function GetContent($str, $pre, $end) {
$pos_pre = strpos($str, $pre) + strlen($pre);
$str_end = substr($str, $pos_pre);
$pos_end = strpos($str_end, $end);
return substr($str, $pos_pre, $pos_end);
}
if(substr($NameID,-4) == ".mp4"){$NameID = substr($NameID,0,strlen($NameID)-4);}
if(substr($NameID,-4) == ".flv"){$NameID = substr($NameID,0,strlen($NameID)-4);}
if(substr($NameID,-3) == "|js"){$NameID = substr($NameID,0,strlen($NameID)-3);}
if(ctype_digit($NameID)){echo "Service Unavailable";exit();}
else{$getxml = getHTTPPage("http://biz.vsdn.tv380.com/playlive.php?".$NameID);
$getpos = strpos($getxml,"rtmp://");
if($getpos>1){$getdownurl = "http://".GetContent($getxml,'rtmp://','"');
header("location: $getdownurl");}else{echo "Service Unavailable";exit();}};
?>