Created
January 30, 2012 21:43
-
-
Save San3ko/1706904 to your computer and use it in GitHub Desktop.
php script - icecast server stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> | |
'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
у меня не работает