-2

I want to get the auth-token from the site

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

Then want to redirect to the site with (the header user-agent Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0)

http://test.m3u8The auth code fount from 0--0 site;

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

bellow is my snippet , which is able to redirect to the page i am wanting . but is unable to send the header.

At the same time video js like similar video player is unable to play video from (the 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);
?>
  • This PHP command just adds a "Location" header to the response, which tells the client (browser in this case) that it might want to visit the URL given, to access a new resource at that URL. The client has no obligation to do that, but browsers generally do, because it's considered user-friendly not to make the user inspect the "Location" response header and decide for themselves. The _browser_ then makes the request to the suggested URL. What headers it sends is up to the browser and this has absolutely nothing whatsoever to do with your PHP script. – ADyson Jan 26 '18 at 14:53
  • @ADyson is there any alternate way like creating own m3u8 with to send specific header ? – shubham ghosh Jan 26 '18 at 15:11
  • Well you could make another request through PHP using `file_get_contents` or `curl` and get that response, and then pass it on to the browser. But it depends what it is and what it does as to whether that would work and achieve the desired result. It's not really clear what your actual end goal is here - you seem to want to reproduce the content of this other site onto your site, but without the user of your site having to log in to the other site? What's the purpose of this? Is this even permitted by the remote site (or the law)? – ADyson Jan 26 '18 at 15:20

1 Answers1

0

gone through your code and you should know you can't send HTTP headers through the header() function. But i could as well show you a little trick that works only via GET. Getting Token via curl example.

 // 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());
Ifeanyi Amadi
  • 776
  • 5
  • 10
  • http://test.m3u8?jct=hVq0gfaCC8CV4OzqfvnHsQ&pxe=1516983304&st=TuxkOEeIcDDv3nBeJHRyGooIWPh8m0lvpfnQlqfMwnvf-Po.*MCSpa3PkXr1VFnMw9rQpeN7lUgII6B6vhCz1PeitULUZDVP8ZRRDaqOu*&user_agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0 – Ifeanyi Amadi Jan 26 '18 at 15:57