Kod
<br>
<center>
<?
$sc[czas] = czas odswierzania podawany w sekundach ( np. 120 );
$sc[host] = "HOST";
$sc[port] = port ( np. 8000 )
$sc[template] = " Prowadzi:<b> [genre] </b><br>Gra od/do:<b>[gg]</b><br>";
# $sc[template] = "<b>Gra od/do:</b> [gg]<br><b>Dj:</b> [genre]<br>";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<META HTTP-EQUIV="Refresh" CONTENT="<?=$sc[czas]?>; >
</head>
<body bgcolor="#efefef">
<font color="black" face="arial" size="2">
<?
if($fp = fsockopen($sc[host], $sc[port]))
{
fputs($fp,"GET /index.html HTTP/1.0rnUser-Agent: XML Getter (Mozilla Compatible)rnrn");
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")
{
// [gg]
$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[gg] = $tmp[1];
else $dat[gg] = "err";
// [genre]
$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[genre] = $tmp[1];
else $dat[genre] = "err";
}
}
else
{
$dat=array();
$dat[status]="err";
}
$co = array('[status]','[gg]','[genre]');
$naco = array($dat[status],$dat[gg],$dat[genre]);
$sc[template] = str_replace($co,$naco,$sc[template]);
echo $sc[template];
?>
</font>
</body>
</center>
</body>
</html>
<center>
<?
$sc[czas] = czas odswierzania podawany w sekundach ( np. 120 );
$sc[host] = "HOST";
$sc[port] = port ( np. 8000 )
$sc[template] = " Prowadzi:<b> [genre] </b><br>Gra od/do:<b>[gg]</b><br>";
# $sc[template] = "<b>Gra od/do:</b> [gg]<br><b>Dj:</b> [genre]<br>";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<META HTTP-EQUIV="Refresh" CONTENT="<?=$sc[czas]?>; >
</head>
<body bgcolor="#efefef">
<font color="black" face="arial" size="2">
<?
if($fp = fsockopen($sc[host], $sc[port]))
{
fputs($fp,"GET /index.html HTTP/1.0rnUser-Agent: XML Getter (Mozilla Compatible)rnrn");
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")
{
// [gg]
$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[gg] = $tmp[1];
else $dat[gg] = "err";
// [genre]
$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[genre] = $tmp[1];
else $dat[genre] = "err";
}
}
else
{
$dat=array();
$dat[status]="err";
}
$co = array('[status]','[gg]','[genre]');
$naco = array($dat[status],$dat[gg],$dat[genre]);
$sc[template] = str_replace($co,$naco,$sc[template]);
echo $sc[template];
?>
</font>
</body>
</center>
</body>
</html>
MOZE GO KTOS NAPRWIC ?