Hallo,
ich habe folgendes Problem mit Shoutstats:
Diese Tool liest bei Shoutcastservern die 7.html aus um an die Information (Hörerzahl) zu kommen.
Jetzt gibt es bei uns weder eine 7.html noch sonst eine HTML datei. Sodass ich der slib.php sagen möchte er soll sich einloggen und im adminbereich die XML auslesen.
Hier erstmal der ein kleiner teil des Standartcode:
PHP:--------------------------------------------------------------------------------
function GetShoutcastStats($host,$port)
{
$fp = fsockopen($host, $port, $errno, $errstr, 30);
// can't connect =(
if (!$fp) {
print("$errstr ($errno)<br>\n");
$server['current'] = 0;
$server['max'] = 0;
// oh yes, it can connect
} else {
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0
(compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
while (!feof($fp)) {
$content .= fgets($fp,128);
}
fclose($fp);
$debut = strpos($content, '<body>') + strlen('<body>');
$fin = strpos($content, '</body>', $debut);
$string = substr($content, $debut, $fin - $debut);
$stats = explode(',', $string);
// server is up but no source is connected
if ($stats[1] == 0) {
$server['current'] = 0;
// everything is ok
} else {
$server['current'] = $stats[0];
}
$server['max'] = $stats[3];
}
// debug
// print("$host:$port = {$server['current']}/{$server['max']}\n");
return $server;
}
?>
--------------------------------------------------------------------------------
Jetzt sagte man mir dass das nicht gehen würde die XML auszulesen, weil der Code nur HTML dateien auslesen würde und man müsse das ganze Umbauen, sprich umcoden. wer könnte mir das umcoden da ich mit php-scripting und xml gar keine erfahrung habe.
Vielen lieben Dank schon mal im Voraus.
LG
Sonic323
ich habe folgendes Problem mit Shoutstats:
Diese Tool liest bei Shoutcastservern die 7.html aus um an die Information (Hörerzahl) zu kommen.
Jetzt gibt es bei uns weder eine 7.html noch sonst eine HTML datei. Sodass ich der slib.php sagen möchte er soll sich einloggen und im adminbereich die XML auslesen.
Hier erstmal der ein kleiner teil des Standartcode:
PHP:--------------------------------------------------------------------------------
function GetShoutcastStats($host,$port)
{
$fp = fsockopen($host, $port, $errno, $errstr, 30);
// can't connect =(
if (!$fp) {
print("$errstr ($errno)<br>\n");
$server['current'] = 0;
$server['max'] = 0;
// oh yes, it can connect
} else {
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0
(compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
while (!feof($fp)) {
$content .= fgets($fp,128);
}
fclose($fp);
$debut = strpos($content, '<body>') + strlen('<body>');
$fin = strpos($content, '</body>', $debut);
$string = substr($content, $debut, $fin - $debut);
$stats = explode(',', $string);
// server is up but no source is connected
if ($stats[1] == 0) {
$server['current'] = 0;
// everything is ok
} else {
$server['current'] = $stats[0];
}
$server['max'] = $stats[3];
}
// debug
// print("$host:$port = {$server['current']}/{$server['max']}\n");
return $server;
}
?>
--------------------------------------------------------------------------------
Jetzt sagte man mir dass das nicht gehen würde die XML auszulesen, weil der Code nur HTML dateien auslesen würde und man müsse das ganze Umbauen, sprich umcoden. wer könnte mir das umcoden da ich mit php-scripting und xml gar keine erfahrung habe.
Vielen lieben Dank schon mal im Voraus.
LG
Sonic323