Strona 1 z 1

[PHP] Błąd w skrypcie statystyk shoutcast

: sob lis 05, 2005 10:10 pm
autor: plusz01
http://www.webinside.pl/php/tutoriale/134 to jest link do artykułu w którym pisze jak zrobić statystyki shoutcasta robie wszystko tak jak w nim pisze i nic wyswietla mi bląd oczywiscie zmieniam dane serwera na moje dane ale pisze mi tak: Parse error: syntax error, unexpected T_STRING in F:\Programy\WebServ\httpd\stat\shot.php on line 9 i jest druga prosa jeżeli by ktoś mogł to zrobić statystyki żeby wyglądały tak ta są przykładowe oczywiscie:

SŁUCHA NAS - (5) / (100)
JAKOŚĆ - 32 kbps
GRA - dj_plusz
GG - 5948929
GRA (od - do) - 17:00 - 18:00
PIOSENKA - aktualna piosenka
REKORD SŁUCHACZY - 66

jak by ktoś mogł to z góry dzienx

Re: [PHP] Błąd w skrypcie statystyk shoutcast

: pn lis 07, 2005 7:09 pm
autor: phpIker
Pokaż co masz w lini 9 i jej okolicach, albo najlepiej pokaż Twój cały kod...

Re: [PHP] Błąd w skrypcie statystyk shoutcast

: pt lis 11, 2005 12:43 pm
autor: plusz01
No to tak w pliku shoucast.class mam taki kod:

[php]<?php
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.0\r\n");
fputs($fp, "User-Agent: Mozilla\r\n\r\n");
while (!feof($fp)) {
$this->dane .= fgets($fp, 512);
}
fclose($fp);
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"]);
}
}
?>[/php]
a w pliki shoutcast.php taki:
[php]<?php
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.”;
}
?> [/php]
oczywiscie dane serwera są przykładowe w pliku mam prawidłowe :D sorka że tak długo nie odpisywałem ale nie miałem neta przez ten okres

Re: [PHP] Błąd w skrypcie statystyk shoutcast

: pt lis 11, 2005 5:06 pm
autor: phpIker
Masz podwójne nawiasy: print “Nazwa serwera:”.$shoutcast->showValue(‘SERVERTITLE’)).”<br>”;
powinno być: print “Nazwa serwera:”.$shoutcast->showValue(‘SERVERTITLE’).”<br>”;
Pozmniej ten bład również w reszcie linijek.

pozdr.

Re: [PHP] Błąd w skrypcie statystyk shoutcast

: pt lis 11, 2005 6:24 pm
autor: plusz01
[php]<?
include('shoutclass.class');
$shoutcast = class ShoutCAST();
$shoutcast->host = '213.251.153.117'; // adres IP serwera
$shoutcast->port = '9500'; // port serwera
$shoutcast->passwd = 'star'; // 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.';
}
?>[/php]
i pisze mi taki błąd Parse error: syntax error, unexpected T_CLASS in F:\Programy\WebServ\httpd\stat\shoutcast.php on line 3[/xml]

Re: [PHP] Błąd w skrypcie statystyk shoutcast

: pt lis 11, 2005 6:33 pm
autor: viraptor
Prawdopodobnie autor miał na myśli:
$shoutcast = new ShoutCAST();

Re: [PHP] Błąd w skrypcie statystyk shoutcast

: pt lis 11, 2005 6:53 pm
autor: phpIker
Zamień w 3 linijce class na new.

Re: [PHP] Błąd w skrypcie statystyk shoutcast

: pt lis 11, 2005 7:32 pm
autor: plusz01
zrobiłem działa ale wyswietla non sto[p że serwer jest wyłączony a podałem dobre dane do serwera co jest podaje jesio raz kody do poszczegółnych plików:
shoutclass.class
[php]<?
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.0\r\n");
fputs($fp, "User-Agent: Mozilla\r\n\r\n");
while (!feof($fp)) {
$this->dane .= fgets($fp, 512);
}
fclose($fp);
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"]);
}
}
?>[/php]
a teraz plik shoutcast.php
[php]<?
include('shoutclass.class');
$shoutcast = new ShoutCAST();
$shoutcast->host = '217.75.59.156'; // adres IP serwera
$shoutcast->port = 8000; // port serwera
$shoutcast->passwd = '5948929'; // 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.';
}
?>[/php]
i wyswietla mi ze serwer jest wyłaczony a serwer nonstop gra co jest ?