Hallo ich brauche Hilfe,
nun soll in meinem Script eine variable $DJ [AIM]
mit dem Passenden Bild ersetzt werden sprich steht dort speedway als ausgabe dan soll das Bild an der Stelle wieder gegeben .
Steht dort jetzt Funy soll er das Bild von Funy zeigen und so weiter..
Habe schon alles Probiert aber bekomme es nicht ohne Hilfe von euch hin...
Hier das Script um das es Geht...
<?php
/*
Shoutcast stats through XML
By Rayeh
http://rayeh.sytes.net
*/
$host = "pmr-funknetz.com"; //Hostname, or ip address of server. IE blah.com or xx.xx.xx.xx
$port = "6000"; //Port server is running on. IE 8000
$password = "pmrstream"; //Password of server, can be normal or admin. Doesn't matter.
//Configuration Finished
//Runs each time an XML element starts
function StartHandler(&$Parser, &$Elem, &$Attr) {
global $Data, $CData;
/* Start with empty CData array. */
$CData = array();
/* Put each attribute into the Data array. */
while ( list($Key, $Val) = each($Attr) ) {
$Data['$Elem:$Key'] = trim($Val);
// debug // echo "$Elem:$Key = " . $Data['$Elem:$Key'] . "\n";
}
}
//Runs each time XML character data is encountered
function CharacterHandler(&$Parser, &$Line) {
global $CData;
/*
* Place lines into an array because elements
* can contain more than one line of data.
*/
$CData[] = $Line;
}
//Runs each time an XML element ends
function EndHandler(&$Parser, &$Elem) {
global $Data, $CData, $listeners, $server, $song, $dj, $wee;
//Mush all of the CData lines into a string and put it into the $Data array.
$Data[$Elem] = trim( implode('', $CData) );
//echo "$Elem = " . $Data[$Elem] . "
\n";
switch ($Elem){
//for each case, we are putting some data into a variable.
case 'AIM':
$dj['AIM'] = $Data['AIM'];
break;
}
}
//open connection
$fp = fsockopen("$host", $port, &$errno, &$errstr, 30);
if (!$fp) {
echo "Connection to server could not be established!
";
}
else {
//request xml
fputs($fp,"GET /admin.cgi?pass=".$password."&mode=viewxml&page=0 HTTP/1.0\nUser-Agent: Mozilla Compatible\n\n");
while(!feof($fp)) {
//put xml into $Data
$Contents .= fgets($fp, 1000);
}
}
//close connection
fclose($fp);
$Contents = str_replace('HTTP/1.0 200 OK','', $Contents);
$Contents = str_replace('Content-Type:text/xml','', $Contents);
$Contents = str_replace("\n",'', $Contents);
$Contents = str_replace("\r",'', $Contents);
$Contents = preg_replace('/(&|&)/i', '&', $Contents);
$Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', "\n", $Contents);
$Data = array();
// Initialize the parser.
$Parser = xml_parser_create('ISO-8859-1');
xml_set_element_handler($Parser, 'StartHandler', 'EndHandler');
xml_set_character_data_handler($Parser, 'CharacterHandler');
//Pass the content string to the parser.
if (!xml_parse($Parser, $Contents)) {
$Probs[] = "$URI$Sym\n Had problem parsing file:\n "
. xml_error_string(xml_get_error_code($Parser));
}
if (isset($Probs)) {
echo implode("\n", $Probs);
}
//Output
$listeners['AVERAGETIME'] = $listeners[AVERAGETIME]/60;
$wee = $wee -1;
//um diese ausgabe geht es
echo "
<table width=600 border=0>
<tr><td>AIM:</td><td>$dj[AIM]</td></tr>\n
//(das soll dan anstelle von $dj[AIM] eingesetzt werden wenn der name übereinstimmt]
speedway =[Blockierte Grafik: http://xxxx.xxxx.xxs/userpics/10002/thumb_Bild005_befo.JPG]
;
?>