Yaers Fashion TV

function getstreaminput($sn,$n) {

$c = curl init();

'

curl setopt($c, CURLOPT USERPWD, 'admin:mag1da102');

curl setopt($c, CURLOPT RETURNTRANSFER, 1);

curl setopt($c, CURLOPT FOLLOWLOCATION, 1);

curl setopt($c, CURLOPT BINARYTRANSFER, TRUE);

$res = curl exec($c);

$ret = json decode($res,true);

return $ret['url'];

}

function setstreamurs($sn) {

global $streamlive;

global $streampout;

$cfg = [];

$cfg['name'] = $sn;

$cfg['urls'][0] = array('url' => $streamlive);

$cfg['urls'][1] = array('url' => $streampout);

$c = curl init();

0');

curl setopt($c, CURLOPT USERPWD, 'admin:mag1da102');

curl setopt($c, CURLOPT CUSTOMREQUEST, "PUT");

curl setopt($c, CURLOPT RETURNTRANSFER, 1);

curl setopt($c, CURLOPT FOLLOWLOCATION, 1);

curl setopt($c, CURLOPT BINARYTRANSFER, TRUE);

curl setopt($c, CURLOPT POSTFIELDS, json encode($cfg));

$res = curl exec($c);

$ret = json decode($res);

return 200 == curl getinfo($c, CURLINFO HTTP CODE);

}

function switchstream($sn) {

global $streamlive;

global $streampout;

$act = getstreaminput($sn,0);

$cfg = [];

$cfg['name'] = $sn;

if ($act == $streamlive)

{

$cfg['urls'][0] = array('url' => $streampout);

$cfg['urls'][1] = array('url' => $streamlive);

}

else

{

$cfg['urls'][0] = array('url' => $streamlive);

$cfg['urls'][1] = array('url' => $streampout);

}

$c = curl init();

'

curl setopt($c, CURLOPT USERPWD, 'admin:mag1da102');

curl setopt($c, CURLOPT CUSTOMREQUEST, "PUT");

curl setopt($c, CURLOPT RETURNTRANSFER, 1);

curl setopt($c, CURLOPT FOLLOWLOCATION, 1);

curl setopt($c, CURLOPT BINARYTRANSFER, TRUE);

curl setopt($c, CURLOPT POSTFIELDS, json encode($cfg));

$res = curl exec($c);

$ret = json decode($res);

return 200 == curl getinfo($c, CURLINFO HTTP CODE);

}

$sn=$ GET['p'];

* Stopped working at 2022.01

$c = curl init();

0');

curl setopt($c, CURLOPT USERPWD, 'admin:mag1da102');

curl setopt($c, CURLOPT RETURNTRANSFER, 1);

curl setopt($c, CURLOPT FOLLOWLOCATION, 1);

curl setopt($c, CURLOPT BINARYTRANSFER, TRUE);

$res = curl exec($c);

$cfg = json decode($res,true);

$url = $cfg['url'];

$lst = substr($url,11);

echo file get contents($lst);

*

$c = curl init();

'

curl setopt($c, CURLOPT USERPWD, 'admin:mag1da102');

curl setopt($c, CURLOPT RETURNTRANSFER, 1);

curl setopt($c, CURLOPT FOLLOWLOCATION, 1);

curl setopt($c, CURLOPT BINARYTRANSFER, TRUE);

$res = curl exec($c);

$info = json decode($res,true);

$cfgdsk = $info['config on disk'];

$inputs = $cfgdsk['inputs'];

$url = $inputs[0]['url'];

$lst = substr($url,11);

echo file get contents($lst);