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

Posty w temacie


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: 25.08.2025 - 07:38