在视频 js 中播放 php

playing php in video js

我想从站点

获取 auth-token

http://0--0.gq/Jio/Bittu_Ghosh_22.php

然后想重定向到带有 (header user-agent Mozilla/5.0 (Windows NT 6.1 ; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0)

http://test.m3u8来自0--0站点的授权码;

喜欢http://test.m3u8?jct=UCS4RJSHD5jo8arL58VzIw&pxe=1516978804&st=ERlTqgAHVcFh0hbcSiHLpI99v030NvaayeUjaqsX1LVG-Po.zwpXoEoe5UjJ8TitkXQUuTbwIHsDgZrGHZze1Hj0OWLpz7RVfZBt6Mpz

下面是我的代码片段,它可以重定向到我想要的页面。但无法发送 header.

同时类似视频播放器的视频js无法播放来自(test.php)

的视频

//Saved This code as test.php

<?php
$location = file_get_contents("http://0--0.gq/Jio/Bittu_Ghosh_22.php");
header('Location: http://test.m3u8'.$location);
?>

检查了您的代码,您应该知道您不能通过 header() 函数发送 HTTP headers。但我也可以向您展示一个只能通过 GET 起作用的小技巧。通过 curl 示例获取令牌。

 // test.php
 $getToken = "http://0--0.gq/Jio/Bittu_Ghosh_22.php";
 $ch = curl_init($getToken);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_HEADER, 0);
 $data = curl_exec($ch);
 $response = curl_getinfo($ch);

 // perhaps no http_user_agent (This is what you desire right?) 
 if(!array_key_exists("http_user_agent", $response))
 {
    $response['http_user_agent'] = @$_SERVER['HTTP_USER_AGENT'];
 }

 // Header response are available in $response variable 
 // Build http query
 $query = !empty($data) ? $data.'&user_agent='.$response['http_user_agent'] : '?user_agent='.$response['http_user_agent'];

 // now send to http://test.m3u8, if you have right to that page you can grab the user agent from the uri.
 header("location: http://test.m3u8{$query}");


// so on test.m3u8 use $_GET['user_agent']; 
$userAgent = $_GET['user_agent'];
if($userAgent != "")
{
   header('http_user_agent: '.$userAgent);
}


 // to check use
print_r(headers_list());