Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Gotowy skrypt ale nie działa
plusz01
post
Post #1





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 11.11.2005

Ostrzeżenie: (0%)
-----


No to tak w pliku shoucast.class mam taki kod:

  1. <? 
  2. class ShoutCAST { 
  3. var $host, $port, $pass, $dane, $values, $indexes;
  4. function connect() { 
  5. $fp = fsockopen($this->host, $this->port, $errno, $errstr, 10); 
  6. if (!$fp) { return false; 
  7. } else { 
  8. fputs($fp, "GET /admin.cgi?pass=".$this->pass."&mode=viewxml HTTP/1.0rn"); 
  9. fputs($fp, "User-Agent: Mozillarnrn"); 
  10. while (!feof($fp)) { 
  11. $this->dane .= fgets($fp, 512); 
  12. } 
  13. fclose($fp); 
  14. if (stristr($this->dane, "HTTP/1.0 200 OK") != true) return false; 
  15. $code_xml = xml_parser_create(); 
  16. if (!xml_parse_into_struct($code_xml, $this->dane, $this->values, $this->indexes)) return false; 
  17. xml_parser_free($code_xml); 
  18. return true; 
  19. } 
  20. }
  21. function showValue($which) { 
  22. return($this->values[$this->indexes[$which][0]]["value"]); 
  23. }
  24. } 
  25. ?>

a w pliki shoutcast.php taki:
  1. <? 
  2. include(&#8216;shoutcast.class’);
  3. $shoutcast = new ShoutCAST(); 
  4. $shoutcast->host = "192.189.45.3"; // adres IP serwera 
  5. $shoutcast->port = 8000; // port serwera 
  6. $shoutcast->passwd = "haslo"; // hasło do serwera 
  7. if ($shoutcast->connect()) { 
  8. if ($shoutcast->showValue(&#8216;STREAMSTATUS’)) { 
  9. print &#8220;Nazwa serwera:”.$shoutcast->showValue(‘SERVERTITLE’)).”<br>”; 
  10. print &#8220;Ilość słuchaczy:”.$shoutcast->showValue(‘CURRENTLISTENERS’)).”<br>”; 
  11. print &#8220;Limit słuchaczy:”.$shoutcast->showValue(‘MAXLISTENERS’)).”<br>”; 
  12. print &#8220;Rekord słuchaczy:”.$shoutcast->showValue(‘PEAKLISTENERS’)).”<br>”; 
  13. print &#8220;Rodzaj serwera:”.$shoutcast->showValue(‘SERVERGENRE’)).”<br>”; 
  14. print &#8220;URL serwera:”.$shoutcast->showValue(‘SERVERURL’)).”<br>”; 
  15. print &#8220;Nazwa piosenki:”.$shoutcast->showValue(‘SONGTITLE’)).”<br>”; 
  16. print &#8220;Jakość nadawania:”.$shoutcast->showValue(‘BITRATE’)).”<br>”; 
  17. print &#8220;IRC:”.$shoutcast->showValue(‘IRC’)).”<br>”; 
  18. print &#8220;AIM:”.$shoutcast->showValue(‘AIM’)).”<br>”; 
  19. print &#8220;ICQ:”.$shoutcast->showValue(‘ICQ’)).”<br>”;
  20. } else { 
  21. print "Serwer jest włączony, ale aktualnie nie ma żadnej audycji."; 
  22. } 
  23. } else { 
  24. print &#8220;Serwer jest wyłączony.”; 
  25. } 
  26. ?> 

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
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
strife
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 605
Pomógł: 96
Dołączył: 22.10.2004
Skąd: UK

Ostrzeżenie: (0%)
-----


Witam,

Na pierwszy rzut oka myślę że chodzi o nawiasy...
  1. <?php
  2.  
  3. $shoutcast->showValue("SERVERTITLE")); // powinno sie zamykac w jeden.
  4.  
  5. ?>

W tych dalszych to samo...

Pozdrawiam!
Go to the top of the page
+Quote Post
plusz01
post
Post #3





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 11.11.2005

Ostrzeżenie: (0%)
-----


no to tak zrobiłem jak kazałeś kod wygląda tak:
  1. <? 
  2. include(&#8216;shoutcast.class’);
  3. $shoutcast = new ShoutCAST();
  4. $shoutcast->host = "192.189.45.3"; // adres IP serwera
  5. $shoutcast->port = 8000; // port serwera
  6. $shoutcast->passwd = "haslo"; // hasło do serwera
  7. if ($shoutcast->connect()) {
  8. if ($shoutcast->showValue(&#8216;STREAMSTATUS’)) {
  9. print &#8220;Nazwa serwera:”.$shoutcast->showValue(‘SERVERTITLE’).”<br>”;
  10. print &#8220;Ilość słuchaczy:”.$shoutcast->showValue(‘CURRENTLISTENERS’).”<br>”;
  11. print &#8220;Limit słuchaczy:”.$shoutcast->showValue(‘MAXLISTENERS’).”<br>”;
  12. print &#8220;Rekord słuchaczy:”.$shoutcast->showValue(‘PEAKLISTENERS’).”<br>”;
  13. print &#8220;Rodzaj serwera:”.$shoutcast->showValue(‘SERVERGENRE’).”<br>”;
  14. print &#8220;URL serwera:”.$shoutcast->showValue(‘SERVERURL’).”<br>”;
  15. print &#8220;Nazwa piosenki:”.$shoutcast->showValue(‘SONGTITLE’).”<br>”;
  16. print &#8220;Jakość nadawania:”.$shoutcast->showValue(‘BITRATE’).”<br>”;
  17. print &#8220;IRC:”.$shoutcast->showValue(‘IRC’).”<br>”;
  18. print &#8220;AIM:”.$shoutcast->showValue(‘AIM’).”<br>”;
  19. print &#8220;ICQ:”.$shoutcast->showValue(‘ICQ’).”<br>”;
  20. } else {
  21. print "Serwer jest włączony, ale aktualnie nie ma żadnej audycji.";
  22. }
  23. } else {
  24. print &#8220;Serwer jest wyłączony.”;
  25. }
  26. ?>

i dalej pisze ten sam błąd w lini 9

Ten post edytował plusz01 12.11.2005, 14:17:45
Go to the top of the page
+Quote Post
strife
post
Post #4





Grupa: Przyjaciele php.pl
Postów: 2 605
Pomógł: 96
Dołączył: 22.10.2004
Skąd: UK

Ostrzeżenie: (0%)
-----


Używaj poprawnego bbCode do umieszczania kodu. Nie poprawiłeś wszystkiego:
  1. <?php
  2.  
  3. if ($shoutcast->connect()) { // tutaj tez usuń
  4. if ($shoutcast->showValue("STREAMSTATUS")) { // i tu tez...
  5.  
  6. ?>


Jakby kod był pokolorowany lepiej by się go czytało...

Zobacz teraz...
Go to the top of the page
+Quote Post
plusz01
post
Post #5





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 11.11.2005

Ostrzeżenie: (0%)
-----


Na początku chciałem przeprosic moderatorów za mój wczesniejszy topic nie przeczytałem że go edytowaliscie przepraszam ale mam juz inną sprawę doszedłem do takiego momentu że juz nie mam zadnego błędu tylko pisze mi że serwer jest wyłączony a ja podaje prawidłowe dane do połączenia sie a tu nic wszystkiego juz próbowałem oto kody moich plików oto pierwszy plik odpowiedzialny za połączenie a jego nazwa to shoutclass.class a oto kod
  1. <? 
  2. class ShoutCAST { 
  3. var $host, $port, $pass, $dane, $values, $indexes; 
  4. function connect() { 
  5. $fp = fsockopen($this->host, $this->port, $errno, $errstr, 10); 
  6. if (!$fp) { return false; 
  7. } else { 
  8. fputs($fp, "GET /admin.cgi?pass=".$this->pass."&mode=viewxml HTTP/1.0rn"); 
  9. fputs($fp, "User-Agent: Mozillarnrn"); 
  10. while (!feof($fp)) { 
  11. $this->dane .= fgets($fp, 512); 
  12. } 
  13. fclose($fp); 
  14. if (stristr($this->dane, "HTTP/1.0 200 OK") != true) return false; 
  15. $code_xml = xml_parser_create(); 
  16. if (!xml_parse_into_struct($code_xml, $this->dane, $this->values, $this->indexes)) return false; 
  17. xml_parser_free($code_xml); 
  18. return true; 
  19. } 
  20. } 
  21. function showValue($which) { 
  22. return($this->values[$this->indexes[$which][0]]["value"]); 
  23. } 
  24. } 
  25. ?>

i jest jeszcze drugi plik pod nazwą shoutcast.php który ma za zadanie wyswietlic pobrane dane i pokazać je na stronie jednak tak nie jest pisze że serwer wyłączony i nic więcej a serwer chodzi cały czas bez zadnych przerw jest audycja dane do serwera które tu podam są przykadowe nie prawidłowe więc prawidłowe mam w soich plikach
  1. <? 
  2. include('shoutclass.class');
  3. $shoutcast = new ShoutCAST();
  4. $shoutcast->host = '217.75.59.156'; // adres IP serwera
  5. $shoutcast->port = '8000'; // port serwera
  6. $shoutcast->passwd = 'lol'; // hasło do serwera
  7. if ($shoutcast->connect()) {
  8. if ($shoutcast->showValue('STREAMSTATUS')) {
  9. print 'SŁUCHA NAS - '.$shoutcast->showValue('(CURRENTLISTENERS)');'<html>/</html>'.$shoutcast->showValue('(MAXLISTENERS)').'<br>';
  10. print 'JAKOŚĆ - '.$shoutcast->showValue('BITRATE').' kbps<br>';
  11. print 'REKORD - '.$shoutcast->showValue('PEAKLISTENERS').'<br>';
  12. print 'GRA - '.$shoutcast->showValue('SERVERGENRE').'<br>';
  13. print 'GG - '.$shoutcast->showValue('AIM').'<br>';
  14. print 'PIOSENKA - '.$shoutcast->showValue('SONGTITLE').'<br>';
  15. } else {
  16. print 'Serwer wyłączony!';
  17. }
  18. } else {
  19. print 'Serwer wyłączony.';
  20. }
  21. ?>

z tego co mi wiadomo poprawiłem wszystkie polskie znaczki gdyby były problemy z kodowaniem np literkę ą zastąpiłem kodem ą i juz po problemie po drugie przerobiłem troszkę skrypt tak aby wyswietlał następujące dane:

SŁUCHA NAS - (5)/(100)
JAOKŚĆ - 32 kbps
REKORD - 50
GRA - dj_plusz
GG - 5948929
PIOSENKA - aktualna piosenka

te dane oczywiscie są przykladowe i zmieniałyby sie w zależnosci od ustawien serwera i ustawien pluginu shoutcast ale nurci mnie tylko to dlaczego nonsotp pokazuje że serwer wyłączony nawet jak jest włączony! proszę o pomoc
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 17:17