Skip to content

Instantly share code, notes, and snippets.

@San3ko
Created January 30, 2012 21:43
Show Gist options
  • Save San3ko/1706904 to your computer and use it in GitHub Desktop.
Save San3ko/1706904 to your computer and use it in GitHub Desktop.
php script - icecast server stats
<?php
$icecast_url='http://10.10.0.1:8000';
$output = file_get_contents($icecast_url);
$search='#<div class="newscontent">.*?Point /(.*?)<.*?href="(.*?)">M3U<.*?Listeners.*?class="streamdata">(.*?)<.*?Song:.*?class="streamdata">(.*?)<.*?</div>#si';
preg_match_all($search, $output, $matches);
$j=count($matches[0]);
for ($i=0;$i<$j; $i++) {
$point_name=$matches[1][$i];
$pount_m3u=$icecast_url.$matches[2][$i];
$point_listners_count=$matches[3][$i];
$point_current_song=$matches[4][$i];
//
echo 'mount point: <b>'.$point_name.'</b>
';
echo 'm3u: <a href="'.$pount_m3u.'">'.$pount_m3u.'</a>
';
echo 'listners_count: <b>'.$point_listners_count.'</b>
';
echo 'point_current_song: <b>'. $point_current_song.'</b>
';
}
?>
@skrebyshi
Copy link

у меня не работает

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment