No to tak w pliku shoucast.class mam taki kod:
<?
class ShoutCAST {
var $host, $port, $pass, $dane, $values, $indexes;
function connect() {
$fp = fsockopen($this->host, $this->port, $errno, $errstr, 10
); if (!$fp) { return false;
} else {
fputs($fp, "GET /admin.cgi?pass=".$this->pass."&mode=viewxml HTTP/1.0rn"); fputs($fp, "User-Agent: Mozillarnrn"); $this->dane .= fgets($fp, 512
); }
if (stristr($this->dane, "HTTP/1.0 200 OK") != true) return false; $code_xml = xml_parser_create();
if (!xml_parse_into_struct($code_xml, $this->dane, $this->values, $this->indexes)) return false;
xml_parser_free($code_xml);
return true;
}
}
function showValue($which) {
return($this->values[$this->indexes[$which][0]]["value"]);
}
}
?>
a w pliki shoutcast.php taki:
<?
include(‘shoutcast.class’);
$shoutcast = new ShoutCAST();
$shoutcast->host = "192.189.45.3"; // adres IP serwera
$shoutcast->port = 8000; // port serwera
$shoutcast->passwd = "haslo"; // hasło do serwera
if ($shoutcast->connect()) {
if ($shoutcast->showValue(‘STREAMSTATUS’)) {
print “Nazwa serwera:”.$shoutcast->showValue(‘SERVERTITLE’)).”<br>”; print “Ilość słuchaczy:”.$shoutcast->showValue(‘CURRENTLISTENERS’)).”<br>”; print “Limit słuchaczy:”.$shoutcast->showValue(‘MAXLISTENERS’)).”<br>”; print “Rekord słuchaczy:”.$shoutcast->showValue(‘PEAKLISTENERS’)).”<br>”; print “Rodzaj serwera:”.$shoutcast->showValue(‘SERVERGENRE’)).”<br>”; print “URL serwera:”.$shoutcast->showValue(‘SERVERURL’)).”<br>”; print “Nazwa piosenki:”.$shoutcast->showValue(‘SONGTITLE’)).”<br>”; print “Jakość nadawania:”.$shoutcast->showValue(‘BITRATE’)).”<br>”; print “IRC:”.$shoutcast->showValue(‘IRC’)).”<br>”; print “AIM:”.$shoutcast->showValue(‘AIM’)).”<br>”; print “ICQ:”.$shoutcast->showValue(‘ICQ’)).”<br>”; } else {
print "Serwer jest włączony, ale aktualnie nie ma żadnej audycji."; }
} else {
print “Serwer jest wyłączony.”; }
?>
oczywiscie dane serwera są przykładowe w pliku mam prawidłowe (IMG:
http://forum.php.pl/style_emoticons/default/biggrin.gif) i wyskakuje mi taki błąd Parse error: syntax error, unexpected T_STRING in F:\Programy\WebServ\httpd\stat\shoutcast.php on line 9
(IMG:
http://forum.php.pl/uwaga.gif)
Tym razem poprawiłe ale w kolejnych postach proszę używać odpowiedniego bbCode.
~mike_mech