<?php

date_default_timezone_set('America/New_York');
header("Content-Type: text/plain");

$id = $_GET['id'];
$eventId = $_GET['eventId'];
$mediaId = $_GET['mediaId'];
$time = $_GET['time'];
$direcctorio = "/var/www/html/star/channels/" . $id;

$server = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$path_video = str_replace ("master_co.php" , 'video_f.php/' , $server);
$path_audio = str_replace ("master_co.php" , 'audio_f.php/' , $server);
$path = str_replace ('master_co.php' , '' , $server);                          
$info = file_get_contents("http://localhost/star/br.php?id=" . $id."&eventId=".$eventId."&mediaId=".$mediaId."&time=".urlencode($time));
$info2 = file_get_contents("http://localhost/star/ec.php?id=" . $id."&eventId=".$eventId."&mediaId=".$mediaId."&time=".urlencode($time));
$json = json_decode($info, true);
$json2 = json_decode($info2, true);

$key = !empty($json['Key']) ? $json['Key'] : $json2['Key'];
$url = $json['url'];

print_r($url);
echo '?decryption_key=';
print_r($key);
