$sc[czas] = '180';
$sc[host] = '91.121.105.99';
$sc[port] = '8000';
if($fp = fsockopen($sc[host], $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] = "on";
elseif( $tmp[1][0] == "down" )
$dat[status] = "off";
else
$dat[status] = "err";
if($dat[status]=="on")
{
// [song]
$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]-7) );
if( $tmp[1] ) $dat[song] = $tmp[1];
else $dat[song] = "Brak";
}
}
else
{
$dat=array();
$dat[status]="err";
}
// WYŚWIETLANIE
echo 'Aktualna nutka: ';
?>