Discussions » Development

necessito ayuda con este script

§
Posted: 2018-04-26

necessito ayuda con este script

hola tengo este script cuando lo pongo en un reproductor como claprr me da este error en chrome ordenador y me gustaria hacerlo funcionar un saludo gracias aqui os dejo los errores y el reproductor y el scrpit

aqui esta el error :

Failed to load http://int.hol.es/la2.php/index.m3u8: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://todotv.epizy.com' is therefore not allowed access.

aqui teneis el scrpit:

<?php ob_start();

function getstringbetween($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start);
$len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); }

$url = 'http://livesports.pw/embedna.php?file=la2&width=650&height=417'; $data = array();

$options = array( 'http' => array( 'header' => array('Accept: /', 'Referer: http://telefivegb.com/canales/tdt/tv2/'), 'method' => 'GET', 'content' => httpbuildquery($data), ), ); $context = streamcontextcreate($options); $key = filegetcontents($url, false, $context,0,4000);

$url2 = getstringbetween($key, "source: '", "',");

//-------------------------------------------------------------

$urlexploded = explode("/",$url2);

$data2 = array(); $options2 = array( 'http' => array( 'header' => array('Accept: /', 'Referer: '.$url), 'method' => 'GET', 'content' => httpbuildquery($data2), ), ); $context2 = streamcontextcreate($options2); $url3 = filegetcontents($url2, false, $context2,0,4000);

$master=str_replace("media","http://".$urlexploded[2]."/".$urlexploded[3]."/".$urlexploded[4]."/"."media",$url3);

header("Content-type: application/x-mpegurl"); echo($master);

exit; ?>

aqui os dejo el reproductor web clappr

<script src="https://cdn.jsdelivr.net/clappr.level-selector/latest/level-selector.min.js"></script>
<script src="https://cdn.jsdelivr.net/clappr.chromecast-plugin/latest/clappr-chromecast-plugin.js"></script>
<div id="player"></div>
<script>var player = new Clappr.Player({
        source: 'http://int.hol.es/la2.php/index.m3u8',
        plugins: [LevelSelector, ChromecastPlugin],
        parentId: '#player',
        height: '100%',
        width: '100%',
        autoPlay: true,
    });
</script>

aqui teneis el m3u8 sacado del network del chrome

Request URL: http://int.hol.es/la2.php/index.m3u8 Request Method: GET Status Code: 200 OK Remote Address: 173.208.195.156:80 Referrer Policy: no-referrer-when-downgrade

HTTP/1.1 200 OK Date: Thu, 26 Apr 2018 03:38:51 GMT Server: Apache/2.4.33 X-Powered-By: PHP/7.1.16 Upgrade: h2,h2c Connection: Upgrade, Keep-Alive Keep-Alive: timeout=1, max=10000 Transfer-Encoding: chunked Content-Type: application/x-mpegurl

GET /la2.php/index.m3u8 HTTP/1.1 Host: int.hol.es Connection: keep-alive Origin: http://todotv.epizy.com User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 Accept: / Referer: http://todotv.epizy.com/prueba1/nacionales/tve2.html Accept-Encoding: gzip, deflate Accept-Language: es-ES,es;q=0.9

Post reply

Sign in to post a reply.