<?php
$url = 'https://play24.ws/channel/ntvmatchfoot1';
$cookies = array();
$userAgent = "Mozilla/5.0 (Linux; Android 8.1; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.1847.114 Mobile Safari/537.36";
// Установка HTTP заголовков
$headers = "User-Agent: $userAgent\r\n";
// Загружаем страницу iframe c moonwalk
$page = LoadPage($url, "GET", $headers);
$chl = GetRegexValue($page, '#data-channel="(.*?)"#');
$url1 = 'https://api.livesports24.online:8443/gethost';
$headers .= "Accept-Encoding: gzip, deflate, br\r\n" .
"Origin: https://sport24hd.com\r\n" ; .
"Host: api.livesports24.online:8443\r\n" .
"Referer: " . $url . "\r\n" .
$page1 = LoadPage($url1, "GET", $headers);
//https://95-213-224-183.livesports24.online/ooomatch.m3u8
include('up.php');
$url_m3u = 'https://'.$page1.'/'.$chl.'.m3u8';
//$rel_link = makeRequest($url_m3u);
//echo '<pre>'.print_r($rel_link);
$streamurl = str_replace('http','http://faraonicup.ru/live/up.php/http',$url_m3u)
?>
<!DOCTYPE>
<html>
<head>
<title>Матч 1</title>
<!--script src="playerjs.js" type="text/javascript"></script-->
<script src="http://faraonicup.ru/playerjs.js" type="text/javascript"></script>
</head>
<body>
<center><div style="width:100%;height:auto;">
<div id="player"></div>
</div></center>
<script>
var player = new Playerjs({id:"player", file:"<?=$streamurl?>", autoplay:"0",poster:"https://static.boom365hd.com/<?=$chl?>.jpg", title:"MELBET"});
</script>
</body>
</html>
<?php
////////////////////
// Получение страницы с указанными методом и заголовками
function LoadPage($url, $method, $headers, $data='') {
global $cookies;
// Если есть кукисы - добавляем их значения в HTTP заголовки
$coo = "";
foreach($cookies as $key => $val) $coo .= $key."=".urlencode($val)."; ";
if ($coo) $headers .= "Cookie: $coo\r\n";
$options = array();
$options['http'] = array('method' => $method ,
'header' => $headers,
'content'=> $data );
$context = stream_context_create($options);
$page = file_get_contents($url, false, $context);
// Перебираем HTTP заголовки ответа, чтобы установить кукис
foreach($http_response_header as $c => $h) {
if (stristr($h, 'content-encoding') and stristr($h, 'gzip')) {
$page = gzdecode($page);
} else if (preg_match('#^Set-Cookie:\s*([^;]+)#', $h, $matches)) {
parse_str($matches[1], $tmp);
$cookies += $tmp;
}
}
return $page;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Функция получения значения по указанному регулярному выражению
function GetRegexValue($text, $pattern, $group=1) {
if (preg_match($pattern, $text, $matches))
return $matches[$group];
return "";
}
?>