up
This commit is contained in:
36
icecast.php
Normal file
36
icecast.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
//script icecast
|
||||
|
||||
function getStreamStatus($server, $mount){
|
||||
$header = get_headers($server.$mount);
|
||||
if($header[0] == 'HTTP/1.0 200 OK'){
|
||||
return 'On Air';
|
||||
}
|
||||
else{
|
||||
return 'Off Air';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getStreamInfo($server, $mount, $indexListeners, $indexPlaying){
|
||||
$output = file_get_contents($server.'/status.xsl?mount='.$mount);
|
||||
$temp_array = array();
|
||||
$search_for = "<td\s[^>]*class=\"streamstats\">(.*)<\/td>";
|
||||
$search_td = array('<td class="streamstats">','</td>');
|
||||
|
||||
if(preg_match_all("/$search_for/siU",$output,$matches)) {
|
||||
foreach($matches[0] as $match) {
|
||||
$to_push = str_replace($search_td,'',$match);
|
||||
$to_push = trim($to_push);
|
||||
array_push($temp_array,$to_push);
|
||||
}
|
||||
}
|
||||
|
||||
$stream_info['currently_playing'] = $temp_array[$indexPlaying];
|
||||
$stream_info['auditeurs'] = $temp_array[$indexListeners];
|
||||
$x = explode(" - ", $temp_array[$indexPlaying]);
|
||||
$stream_info['artiste'] = $x[0];
|
||||
$stream_info['titre'] = $x[1];
|
||||
return $stream_info;
|
||||
}
|
||||
Reference in New Issue
Block a user