When I run my php code it shows the content perfectly, but there's a space after start and before stop. How do I remove all spaces? I thought that's what I was doing with trim
?
<?php
function getURL($u){
$ops = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept: text/html
" .
"User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0
"
)
);
$co = stream_context_create($ops);
$r = file_get_contents('http://' . $u, false, $co);
return $r != false ? $r : "";
}
function GetStringBetween($string, $start, $finish){
$string = " ".$string;
$position = strpos($string, $start);
if ($position == 0) return "";
$position += strlen($start);
$length = strpos($string, $finish, $position) - $position;
return substr($string, $position, $length);
}
$grab = file_get_contents('myurl');
$m3u8 = file_get_contents( trim($grab) );
$stream = GetStringBetween($m3u8, 'start"', '#stop');
?>
start<?=$stream?>stop