No dobra przerzuciłem się an inny skrypt, który obecnie wygląda tak:
<!--
SKRYPT STATYSTYK SERWERA SHOUTCAST
DLA RADIA INTERNETOWEGO
grafika, html & uzupelnienia w skrypcie php (c) Majkell 2005
Portal EMSoft - Polskie Centrum SHOUTcast
<a href=\"htt://www.radiostacja.prv.pl\" target=\"_blank\">htt://www.radiostacja.prv.pl</a>
-->
<?
$sc[czas] = 180;
$sc[host
] = "po-co-to-wam-potrzebne ?
"; $sc[port] = 8000;
$sc[template1] = "<b>[radio]</b>";
$sc[template2] = "<b>[aim]</b>";
{
fputs($fp,"GET /index.html HTTP/1.0r\nUser-Agen: XML Getter (Mozilla Compatible)r\nr\n"); fgets($fp);fgets
($fp);fgets
($fp);
a
// [status]
$m[0]="Server is currently";
$m[1]="";
if( $tmp[1][0] == "up" )
$dat[status] = "On";
elseif( $tmp[1][0] == "down" )
$dat[status] = "Off";
else
$dat[status] = "err";
if($dat[status]=="On")
{
// [radio]
$m[0]="Stream Titl:";
$m[1]="Content Typ:";
$tmp[1
]=trim( substr( $in , $mp[0
] + $ml[0
] , $mp[1
]-$mp[0
]-$ml[1
] ) );
if( $tmp[1] ) $dat[radio] = $tmp[1];
else $dat[radio] = "err";
// [aim]
$m[0]="Stream AI:";
$m[1]="Stream IR:";
$tmp[1
]=trim( substr( $in , $mp[0
] + $ml[0
] , $mp[1
]-$mp[0
]-$ml[1
] ) );
if( $tmp[1] ) $dat[aim] = $tmp[1];
else $dat[aim] = "err";
// [genre]
$m[0]="Stream Genr:";
$m[1]="Stream UR:";
$tmp[1
]=trim( substr( $in , $mp[0
] + $ml[0
] , $mp[1
]-$mp[0
]-$ml[1
]-2
) );
if( $tmp[1] ) $dat[genre] = $tmp[1];
else $dat[genre] = "err";
// [ile]
$m[0]="kbps with";
$m[1]="listeners";
$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] = "err";
// [max]
$m[0]="kbps with";
$m[1]="listeners";
$tmp[1
]=explode( " " , trim( substr( $in , $mp[0
] + $ml[0
] , $mp[1
]-$mp[0
]-$ml[1
]-2
) ) );
if( $tmp[1
] ) $dat[max] = $tmp[1
][2
];
// [peak]
$m[0]="Listener Pea:";
$m[1]="Average";
$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] = "err";
}
}
else
{
$dat[status]="err";
}
$co = array('[status]','[radio]','[aim]','[genre]','[ile]','[max]','[peak]'); $naco = array($dat[status
],$dat[radio
],$dat[aim
],$dat[genre
],$dat[ile
],$dat[max],$dat[peak
]); $sc[template1
] = str_replace($co,$naco,$sc[template1
]); $sc[template2
] = str_replace($co,$naco,$sc[template2
]);
$fp1 = @fsockopen($sc[host
], $sc[port
], &$errno, $errstr, 10
, $float ,3
); // próbowałem ustawić timeout - bez rezultatu...
if (!$fp1) {
$text = "Aktualnie nie nadajemy";
} else {
fputs($fp1, "GET /7 HTTP/1.1\nUser-Agen:Mozilla\n\n");
for($i = 0; $i < 1; $i++) {
$fp_data1 = fread($fp1, 31337
); }
list
($current1, $status1, $peak1, $max1, $reported1, $bit1, $song1) = explode(",", $fp_data1, 7
);
if ($status1 == "1")
$text = "$song1";
else
$text = "Aktualnie nie nadajemy";
}
// TU WSTAW ADRESY DO ZDJEC DJ'OW - WEDLUG WZORU
if ($dat[aim] == "AutoPilot") $fotka = "pilot.jpg"; else
if ($dat[aim] == "*") $fotka = "brak.gif"; else
if ($dat[aim] == "*") $fotka = "brak.gif"; else
if ($dat[aim] == "*") $fotka = "brak.gif"; else
$fotka = "brak.gif";
?>
<table cellspacing="0" cellpadding="0" height="216" width="140" border="0" background ="tlo.gif">
<tr><td width ="100%" height ="19" colspan ="2">
<center><font size ="2" face ="Verdana" color ="black"><b>
<a name="pokaz">
Radio *
</b><br></font></center>
</td></tr>
<tr><td width ="80%" height ="15" valign ="top" colspan ="2">
<center><font size ="1" face ="Arial"><b>
<A href ="htt://******" target ="_blank"><font color ="brown">Nasze RadiO</font></A>
</b><br></font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
<? echo $sc[template1
]; ?> </MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
</MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="alternate" onMouseOver='this.stop()' onMouseOut='this.start()'>
<? echo $sc[template2
]; ?> </MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="6" colspan ="2">
</td></tr>
<tr><td width ="65" height ="80" valign ="top">
<a href ="******:8000/listen.pls"><img src ="separ.gif" width ="65" height ="70" border ="0"></a><br clear ="all">
<td width ="75" height ="80" valign ="top">
<? print "<img src ='$fotka' width ='62' height ='70'>"; ?> <br clear ="all">
</td></tr>
</table>
I teraz mam trochę podobny problem, skrypt pokazuje, jeśli nie może się połączyć, ale przed statusem wywala błąd i na dodatek skrypt ładuje się kilka minut...
O ile z przesunięciem sobie poradziłem, bo status mam w IFRAME, wystarczyło zrobić kotwice i wyłączyc scrollowanie, to ze stroną ładującą sie 2-3 minuty sobie nie poradziłem, próbowałem ustawiać różne timeouty dla fsockopen ale nic nie działa...
Proszę o pomoc!