任何人都可以帮助使用php从下面的链接中提取当前的侦听器计数我也在下面附加了phph代码,但它需要修改
http://209.105.250.69:8382/
来源如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Icecast Streaming Media Server</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<h2>Icecast2 Status</h2>
<br><div class="roundcont">
<div class="roundtop"><img src="/corner_topleft.jpg" class="corner" style="display: none"></div>
<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="4"><tr><td bgcolor="#656565">
<a class="nav" href="admin/">Administration</a><a class="nav" href="status.xsl">Server Status</a><a class="nav" href="server_version.xsl">Version</a>
</td></tr></table>
<div class="roundbottom"><img src="/corner_bottomleft.jpg" class="corner" style="display: none"></div>
</div>
<br><br><div class="roundcont">
<div class="roundtop"><img src="/corner_topleft.jpg" class="corner" style="display: none"></div>
<div class="newscontent">
<div class="streamheader"><table cellspacing="0" cellpadding="0">
<colgroup align="left"></colgroup>
<colgroup align="right" width="300"></colgroup>
<tr>
<td><h3>Mount Point /listen.mp3</h3></td>
<td align="right">
<a href="/listen.mp3.m3u">M3U</a><a href="/listen.mp3.xspf">XSPF</a>
</td>
</tr>
</table></div>
<table border="0" cellpadding="4">
<tr>
<td>Stream Title:</td>
<td class="streamdata">Quran Kareem Radio</td>
</tr>
<tr>
<td>Stream Description:</td>
<td class="streamdata">Quran Kareem Radio</td>
</tr>
<tr>
<td>Content Type:</td>
<td class="streamdata">audio/mpeg</td>
</tr>
<tr>
<td>Mount started:</td>
<td class="streamdata">Thu, 11 Apr 2013 19:19:59 -0400</td>
</tr>
<tr>
<td>Bitrate:</td>
<td class="streamdata">60</td>
</tr>
<tr>
<td>Current Listeners:</td>
<td class="streamdata">5</td>
</tr>
<tr>
<td>Peak Listeners:</td>
<td class="streamdata">25</td>
</tr>
<tr>
<td>Stream Genre:</td>
<td class="streamdata">Islam</td>
</tr>
<tr>
<td>Stream URL:</td>
<td class="streamdata"><a target="_blank" href="http://qkradio.com.au">http://qkradio.com.au</a></td>
</tr>
<tr>
<td>Current Song:</td>
<td class="streamdata"></td>
</tr>
</table>
</div>
<div class="roundbottom"><img src="/corner_bottomleft.jpg" class="corner" style="display: none"></div>
</div>
<br><br>
<div class="poster">Support icecast development at <a class="nav" target="_blank" href="http://www.icecast.org">www.icecast.org</a>
</div>
</body>
</html>
到目前为止,我已经使用了以下内容,但需要对其进行修改
<?php
$fp = fsockopen("listen.qkradio.com.au", 8382, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
for($i=0; $i<30; $i++) {
if(feof($fp)) break;
$fp_data=fread($fp,31337);
usleep(500000);
}
$fp_data=ereg_replace("^.*<body>","",$fp_data);
$fp_data=ereg_replace("</body>.*","",$fp_data);
list($current,$status,$peak,$max,$unique,$bitrate,$song) = explode(",", $fp_data);
if ($status == "0") {
echo "<center>Off Air</center>";
} else {
echo "<TABLE>";
//start edit below - comment with "//" unnecessary lines
echo "<TR><TD>Current Listeners: </TD><TD>".$current."</TD></TR>";
//echo "<TR><TD>Server Status: </TD><TD>".$status."</TD></TR>";
//stop editing from here
echo "</TABLE>";
//start edit below - comment with "//" next line to stop scrolling
echo "<marquee>".$song."</marquee>";
//stop editing here
}}
?>