![]() |
![]() |
--MasterDisaster-- |
![]()
Post
#1
|
Goście ![]() |
Witam, otóż posiadam kod do pobierania informacji shoutcasta który wygląda tak:
Kod <html> <head> <meta http-equiv="Content-Language" content="pl"> <!-- m4ti.tk --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /> <meta http-equiv="Refresh" content="60" /> <link rel="stylesheet" href="staty.css" type="text/css"> </head> <? $sc[ip] = "sc5.24cast.pl"; $sc[port] = 8014; $sc[table1] = "[dj][status]"; $sc[table2] = "[audycja][status]"; $sc[table3] = "[nuta][status]"; $sc[table4] = "[ile]"; if($fp = fsockopen($sc[ip] , $sc[port])) { fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); fgets($fp);fgets($fp);fgets($fp); while(!feof($fp)) $in.=strip_tags(fgets($fp)); fclose($fp); # echo $in; // [status] $m[0]="Server is currently"; $m[1]=""; $mp[0]=strpos($in,$m[0]); $mp[1]=@strpos($in,$m[1]); $ml[0]=strlen($m[0]); $ml[1]=strlen($m[1]); $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) ); if( $tmp[1][0] == "up" ) $dat[status] = ""; elseif( $tmp[1][0] == "down" ) $dat[status] = "Brak Audycji"; else $dat[status] = ""; if($dat[status]=="") { // [audycja] $m[0]="Stream Title:"; $m[1]="Content Type:"; $mp[0]=strpos($in,$m[0]); $mp[1]=strpos($in,$m[1]); $ml[0]=strlen($m[0]); $ml[1]=strlen($m[1]); $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) ); if( $tmp[1] ) $dat[audycja] = $tmp[1]; else $dat[audycja] = ""; // [dj] $m[0]="Stream Genre:"; $m[1]="Stream URL:"; $mp[0]=strpos($in,$m[0]); $mp[1]=strpos($in,$m[1]); $ml[0]=strlen($m[0]); $ml[1]=strlen($m[1]); $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ); if( $tmp[1] ) $dat[dj] = $tmp[1]; else $dat[dj] = ""; // [statyw] $m[0]="Stream AIM:"; $m[1]="Stream IRC:"; $mp[0]=strpos($in,$m[0]); $mp[1]=strpos($in,$m[1]); $ml[0]=strlen($m[0]); $ml[1]=strlen($m[1]); $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) ); if( $tmp[1] ) $dat[statyw] = $tmp[1]; else $dat[statyw] = "pilot"; // [gg] $m[0]="Stream ICQ:"; $m[1]="Stream AIM:"; $mp[0]=strpos($in,$m[0]); $mp[1]=strpos($in,$m[1]); $ml[0]=strlen($m[0]); $ml[1]=strlen($m[1]); $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) ); if( $tmp[1] ) $dat[gg] = $tmp[1]; else $dat[gg] = ""; // [ile] $m[0]="kbps with"; $m[1]="listeners"; $mp[0]=strpos($in,$m[0]); $mp[1]=strpos($in,$m[1]); $ml[0]=strlen($m[0]); $ml[1]=strlen($m[1]); $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) ); if( $tmp[1] ) $dat[ile] = $tmp[1][0]; else $dat[ile] = ""; // [peak] $m[0]="Listener Peak:"; $m[1]="Average"; $mp[0]=strpos($in,$m[0]); $mp[1]=strpos($in,$m[1]); $ml[0]=strlen($m[0]); $ml[1]=strlen($m[1]); $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-7) ); if( $tmp[1] ) $dat[peak] = $tmp[1]; else $dat[peak] = ""; // [nuta] $m[0]="Current Song:"; $m[1]="Written by Ste"; $mp[0]=strpos($in,$m[0]); $mp[1]=strpos($in,$m[1]); $ml[0]=strlen($m[0]); $ml[1]=strlen($m[1]); $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) ); if( $tmp[1] ) $dat[nuta] = $tmp[1]; else $dat[nuta] = ""; } } else { $dat=array(); $dat[status]="error"; } $co = array('[status]','[audycja]','[dj]','[statyw]','[gg]','[ile]','[peak]','[nuta]'); $naco = array($dat[status],$dat[audycja],$dat[dj],$dat[statyw],$dat[gg],$dat[ile],$dat[peak],$dat[nuta]); $sc[table1] = str_replace($co,$naco,$sc[table1]); $sc[table2] = str_replace($co,$naco,$sc[table2]); $sc[table3] = str_replace($co,$naco,$sc[table3]); $sc[table4] = str_replace($co,$naco,$sc[table4]); ?> <font color="#000" FACE="Tahoma"><b> <table id="Table_01" width="950" height="200" border="0" cellpadding="0" cellspacing="0" background="player.png"> <tr> <td colspan="5" width="950" height="47" alt=""></td> <td width="1" height="47" alt=""></td> </tr> <tr> <td colspan="3" width="283" height="3" alt=""></td> <td rowspan="2" width="169" height="31" alt=""><marquee behavior="scroll" width="169" height="14" onmouseover="this.stop();" onmouseout="this.start();" scrollamount='2' scrolldelay="20"><? echo $sc[table2]; ?></marquee></td></td> <td rowspan="8" width="498" height="153" alt=""></td> <td width="1" height="3" alt=""></td> </tr> <tr> <td rowspan="7" width="73" height="150" alt=""></td> <td rowspan="5" width="100" height="100" alt=""><img src="avek.jpg"></td> <td rowspan="7" width="110" height="150" alt=""></td> <td width="1" height="28" alt=""></td> </tr> <tr> <td width="169" height="9" alt=""></td> <td height="9" alt=""></td> </tr> <tr> <td width="169" height="31" alt=""><marquee behavior="alternate" width="169" height="14" onmouseover="this.stop();" onmouseout="this.start();" scrollamount='2' scrolldelay="20"><? echo $sc[table1]; ?></marquee></td></td> <td width="1" height="31" alt=""></td> </tr> <tr> <td width="169" height="9" alt=""></td> <td width="1" height="9" alt=""></td> </tr> <tr> <td rowspan="2" width="169" height="31" alt=""><marquee behavior="scroll" width="169" height="14" onmouseover="this.stop();" onmouseout="this.start();" scrollamount='2' scrolldelay="20"><? echo $sc[table3]; ?></marquee></td></td> <td width="1" height="23" alt=""></td> </tr> <tr> <td rowspan="2" width="100" height="50" alt=""></td> <td width="1" height="8" alt=""></td> </tr> <tr> <td width="169" height="42" alt=""></td> <td width="1" height="42" alt=""></td> </tr> </table> </font></b> </html> kod ten inkludowałem w theme.php poprzez : Kod include("staty2.php"); i wszystko działa ładnie i pięknie, tylko że wyświetlane statystyki po jakimś czasie się automatycznie odswieżają razem z całą stroną. Chciałbym jednak żeby odświeżały się wyłącznie statystyki. Btw. w Dzienniku błędów wyświetla się masa błędów dotyczących pliku php statystyk. |
|
|
![]() |
-Master Disaster- |
![]()
Post
#2
|
Goście ![]() |
Ponieważ nie moge edytować posta, chciałem dodać że korzystam z PHP-Fusion
|
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 2 958 Pomógł: 574 Dołączył: 23.09.2008 Skąd: wiesz, że tu jestem? Ostrzeżenie: (0%) ![]() ![]() |
Poczytaj o
- ajax - jquery (ułatwia korzystanie z ajaxa) lub - iframe (od biedy) Ten post edytował CuteOne 25.03.2013, 20:12:56 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 15.09.2025 - 18:13 |