Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Status Shoutcast ON/OFF, Poszukuje...
desavil
post
Post #1





Grupa: Zarejestrowani
Postów: 339
Pomógł: 3
Dołączył: 15.10.2008
Skąd: Internet

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


Siemanko, poszukuję skryptu samego który będzie pokazywał czy mój serwer jest włączony czy wyłączony. Po prostu chcę aby pisało on albo off. Pozdrawiam
Powód edycji: [erix]: przeniosłem
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Marcuez
post
Post #2





Grupa: Zarejestrowani
Postów: 98
Pomógł: 1
Dołączył: 7.07.2009
Skąd: Poligon Osielsko

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


  1. <?
  2. $sc[czas] = 20;
  3. $sc[host] = "2.nadajnik.net";
  4. $sc[port] = 7000;
  5.  
  6. $sc[template1] = "<b>[radio]</b>";
  7. $sc[template2] = "<b>[aim]</b>";
  8.  
  9. if($fp = fsockopen($sc[host], $sc[port]))
  10. {
  11. fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
  12. fgets($fp);fgets($fp);fgets($fp);
  13. while(!feof($fp)) $in.=strip_tags(fgets($fp));
  14. fclose($fp);
  15.  
  16.  
  17. // [status]
  18. $m[0]="Server is currently";
  19. $m[1]="";
  20. $mp[0]=strpos($in,$m[0]);
  21. $mp[1]=@strpos($in,$m[1]);
  22. $ml[0]=strlen($m[0]);
  23. $ml[1]=strlen($m[1]);
  24.  
  25. $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) );
  26.  
  27. if( $tmp[1][0] == "up" )
  28. $dat[status] = "On";
  29. elseif( $tmp[1][0] == "down" )
  30. $dat[status] = "Off";
  31. else
  32. $dat[status] = "err";
  33.  
  34. if($dat[status]=="On")
  35. {
  36. // [radio]
  37. $m[0]="Stream Title:";
  38. $m[1]="Content Type:";
  39. $mp[0]=strpos($in,$m[0]);
  40. $mp[1]=strpos($in,$m[1]);
  41. $ml[0]=strlen($m[0]);
  42. $ml[1]=strlen($m[1]);
  43.  
  44. $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
  45.  
  46. if( $tmp[1] ) $dat[radio] = $tmp[1];
  47. else $dat[radio] = "err";
  48.  
  49. // [aim]
  50. $m[0]="Stream AIM:";
  51. $m[1]="Stream IRC:";
  52. $mp[0]=strpos($in,$m[0]);
  53. $mp[1]=strpos($in,$m[1]);
  54. $ml[0]=strlen($m[0]);
  55. $ml[1]=strlen($m[1]);
  56.  
  57. $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
  58.  
  59. if( $tmp[1] ) $dat[aim] = $tmp[1];
  60. else $dat[aim] = "err";
  61.  
  62. // [genre]
  63. $m[0]="Stream Genre:";
  64. $m[1]="Stream URL:";
  65. $mp[0]=strpos($in,$m[0]);
  66. $mp[1]=strpos($in,$m[1]);
  67. $ml[0]=strlen($m[0]);
  68. $ml[1]=strlen($m[1]);
  69.  
  70. $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );
  71.  
  72. if( $tmp[1] ) $dat[genre] = $tmp[1];
  73. else $dat[genre] = "err";
  74.  
  75. // [ile]
  76. $m[0]="kbps with";
  77. $m[1]="listeners";
  78. $mp[0]=strpos($in,$m[0]);
  79. $mp[1]=strpos($in,$m[1]);
  80. $ml[0]=strlen($m[0]);
  81. $ml[1]=strlen($m[1]);
  82.  
  83. $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
  84.  
  85. if( $tmp[1] ) $dat[ile] = $tmp[1][0];
  86. else $dat[ile] = "err";
  87.  
  88. // [max]
  89. $m[0]="kbps with";
  90. $m[1]="listeners";
  91. $mp[0]=strpos($in,$m[0]);
  92. $mp[1]=strpos($in,$m[1]);
  93. $ml[0]=strlen($m[0]);
  94. $ml[1]=strlen($m[1]);
  95.  
  96. $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
  97.  
  98. if( $tmp[1] ) $dat[max] = $tmp[1][2];
  99. else $dat[max] = "err";
  100.  
  101. // [peak]
  102. $m[0]="Listener Peak:";
  103. $m[1]="Average";
  104. $mp[0]=strpos($in,$m[0]);
  105. $mp[1]=strpos($in,$m[1]);
  106. $ml[0]=strlen($m[0]);
  107. $ml[1]=strlen($m[1]);
  108.  
  109. $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-7) );
  110.  
  111. if( $tmp[1] ) $dat[peak] = $tmp[1];
  112. else $dat[peak] = "err";
  113.  
  114.  
  115. }
  116. }
  117. else
  118. {
  119. $dat=array();
  120. $dat[status]="err";
  121. }
  122.  
  123. $co = array('[status]','[radio]','[aim]','[genre]','[ile]','[max]','[peak]');
  124. $naco = array($dat[status],$dat[radio],$dat[aim],$dat[genre],$dat[ile],$dat[max],$dat[peak]);
  125. $sc[template1] = str_replace($co,$naco,$sc[template1]);
  126. $sc[template2] = str_replace($co,$naco,$sc[template2]);
  127.  
  128. $fp1 = @fsockopen($sc[host], $sc[port], &$errno, &$errstr, 10);
  129.  
  130. if (!$fp1) {
  131. $text = "Aktualnie nie nadajemy";
  132. } else {
  133.  
  134. fputs($fp1, "GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
  135.  
  136. for($i = 0; $i < 1; $i++) {
  137. if (feof($fp1)) break;
  138. $fp_data1 = fread($fp1, 31337);
  139. usleep(500000);
  140. }
  141.  
  142. $fp_data1 = ereg_replace("^.*<body>", "", $fp_data1);
  143. $fp_data1 = ereg_replace("</body>.*", "", $fp_data1);
  144.  
  145. list($current1, $status1, $peak1, $max1, $reported1, $bit1, $song1) = explode(",", $fp_data1, 7);
  146.  
  147. if ($status1 == "1")
  148. $text = "$song1";
  149. else
  150. $text = "Aktualnie nie nadajemy";
  151. }
  152.  
  153. // TU WSTAW ADRESY DO ZDJEC DJ'OW - WEDLUG WZORU
  154.  
  155. if ($dat[aim] == "AutoPilot") $fotka = "pilot.jpg"; else
  156.  
  157.  
  158. $fotka = "brak.gif";
  159.  
  160. ?>
  161.  
  162. <table cellspacing="0" cellpadding="0" height="216" width="140" border="0" background ="tlo.gif">
  163. <tr><td width ="100%" height ="19" colspan ="2">
  164. <center><font size ="2" face ="Verdana" color ="black"><b>
  165. Radio-Xena
  166. </b><br></font></center>
  167. </td></tr>
  168. <tr><td width ="80%" height ="15" valign ="top" colspan ="2">
  169. <center><font size ="1" face ="Arial"><b>
  170. <A href ="http://www.radio-xena.com" target ="_blank"><font color ="brown">www.radio-xena.com</font></A>
  171. </b><br></font></center>
  172. </td></tr>
  173. <tr><td width ="100%" height ="15" colspan ="2">
  174. </td></tr>
  175. <tr><td width ="100%" height ="17" valign ="top" colspan ="2">
  176. <center><font size ="2" face ="Courier" color ="black"><b>
  177. <MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
  178. <? echo $sc[template1]; ?>
  179. </MARQUEE>
  180. </font></center>
  181. </td></tr>
  182. <tr><td width ="100%" height ="15" colspan ="2">
  183. </td></tr>
  184. <tr><td width ="100%" height ="17" valign ="top" colspan ="2">
  185. <center><font size ="2" face ="Courier" color ="black"><b>
  186. <MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
  187. <? echo $text; ?>
  188. </MARQUEE>
  189. </font></center>
  190. </td></tr>
  191. <tr><td width ="100%" height ="15" colspan ="2">
  192. </td></tr>
  193. <tr><td width ="100%" height ="17" valign ="top" colspan ="2">
  194. <center><font size ="2" face ="Courier" color ="black"><b>
  195. <MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="alternate" onMouseOver='this.stop()' onMouseOut='this.start()'>
  196. <? echo $sc[template2]; ?>
  197. </MARQUEE>
  198. </font></center>
  199. </td></tr>
  200. <tr><td width ="100%" height ="6" colspan ="2">
  201. </td></tr>
  202. <tr><td width ="65" height ="80" valign ="top">
  203. <a href ="http://sc1.24cast.pl:8180/listen.pls"><img src ="separ.gif" width ="65" height ="70" border ="0"></a><br clear ="all">
  204. <td width ="75" height ="80" valign ="top">
  205. <? print "<img src ='$fotka' width ='62' height ='70'>"; ?>
  206. <br clear ="all">
  207. </td></tr>
  208. </table>

10s. w Google i masz gotowca!

Ten post edytował Marcuez 25.09.2009, 16:31:12
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: 29.12.2025 - 07:30