Archiv verlassen und diese Seite im Standarddesign anzeigen : Fatal error: Call to undefined method radio::time_format() in /var/www/vhosts/dragonl
itsdragonstyle 24-09-2009, 14:26 Ich bin am verzweifeln... weiss nicht mehr weiter, an was dass denn liegen könnte.. bin eigentlich nen neuanfänger was dies angeht.... Soll eigentlich eine art playlist werden, wo man die letzten 10 titel sieht....
hier mal der code:
radio.class:
<?php
class radio{
function init(){ // Initialisierung und erzeugung des Arrays mit den Werten
$x_xml = $this->get_xml();
$this->parse_xml($x_xml);
}
function get_xml(){ // XML Status auslesen und alles unn�tige entfernen
// return implode(file("icecast2.xml")); // Auskommentieren beim Einsatz, nur f�r Testzwecke
$sp = @fsockopen($this->host, $this->port, &$errno, &$errstr, 10);
if (!$sp)
die('Error while connecting to Server.');
else{
set_socket_blocking($sp, false);
if($this->serv == "shoutcast"){
fputs($sp, "GET /admin.cgi?pass=" . $this->pass . "&mode=viewxml HTTP/1.1\nUser-Agent: Mozilla\n\n");
}
else if($this->serv == "icecast"){
fputs($sp, "GET /admin/stats.xml HTTP/1.1\nUser-Agent: Mozilla\n");
fputs($sp, "Host: " . $this->host . "\n");
fputs($sp, "Authorization: Basic " . base64_encode("admin:" . $this->pass) . "\n\n");
}
else
die('There is no Server selected. Please select \"shoutcast\" or \"icecast\".');
for($i = 0; $i < 30; $i++) {
if(feof($sp))
break;
$sp_data .= fread($sp, 31337);
usleep(500000);
}
}
if($this->serv == "shoutcast")
$sp_data = ereg_replace("^.*<SHOUTCASTSERVER", "<SHOUTCASTSERVER", $sp_data);
if($this->serv == "icecast")
$sp_data = ereg_replace("^.*<icestats", "<icestats", $sp_data);
return $sp_data;
}
function set_host($host){ // Host schreiben
$this->host = $host;
}
function set_port($port){ // Port schreiben
$this->port = $port;
}
function set_pass($pass){ // Passwort schreiben
$this->pass = $pass;
}
function set_serv($serv){ // Serverart schreiben
$this->serv = $serv;
}
function parse_xml($x_xml){ // XML Baum verarbeiten, Array mit Tags und Werten, Array mit Songhistory (Shoutcast) und Array mit H�rern (shoutcast) erzeugen
$x_data_flag = FALSE;
$x_parser = xml_parser_create();
xml_parse_into_struct($x_parser, $x_xml, $x_vals, $x_index);
xml_parser_free($x_parser);
$this->x_vals = $x_vals;
$this->x_index = $x_index;
if($this->serv == "shoutcast"){
$this->status = $x_vals[$x_index['STREAMSTATUS'][0]]['value'];
$this->current_listeners = $x_vals[$x_index['CURRENTLISTENERS'][0]]['value'];
$this->peak_listeners = $x_vals[$x_index['PEAKLISTENERS'][0]]['value'];
$this->max_listeners = $x_vals[$x_index['MAXLISTENERS'][0]]['value'];
$this->average_time = $x_vals[$x_index['AVERAGETIME'][0]]['value'];
$this->server_genre = $x_vals[$x_index['SERVERGENRE'][0]]['value'];
$this->server_url = $x_vals[$x_index['SERVERURL'][0]]['value'];
$this->server_title = $x_vals[$x_index['SERVERTITLE'][0]]['value'];
$x_title = explode(" - ", $x_vals[$x_index['SONGTITLE'][0]]['value']);
$this->artist = $x_title[0];
$this->title = $x_title[1];
$this->song_url = $x_vals[$x_index['SONGURL'][0]]['value'];
$this->irc = $x_vals[$x_index['IRC'][0]]['value'];
$this->aim = $x_vals[$x_index['AIM'][0]]['value'];
$this->icq = $x_vals[$x_index['ICQ'][0]]['value'];
$this->version = $x_vals[$x_index['VERSION'][0]]['value'];
$this->listeners();
$this->song_history();
}
else if($this->serv == "icecast"){
$x_count = 0;
$xa_count = 0;
while($x_index['SOURCE'][$x_count]){
if($x_vals[$x_index['SOURCE'][$x_count]]['type'] == "open"){
$x_array[] = $x_index['SOURCE'][$x_count];
$this->mounts[$xa_count]['mount'] = $x_vals[$x_index['SOURCE'][$x_count]]['attributes']['MOUNT'];
$this->mounts[$xa_count]['artist'] = $x_vals[$x_index['ARTIST'][$xa_count]]['value'];
$this->mounts[$xa_count]['audio_bitrate'] = $x_vals[$x_index['AUDIO_BITRATE'][$xa_count]]['value'];
$this->mounts[$xa_count]['audio_channels'] = $x_vals[$x_index['AUDIO_CHANNELS'][$xa_count]]['value'];
$this->mounts[$xa_count]['audio_info'] = $x_vals[$x_index['AUDIO_INFO'][$xa_count]]['value'];
$this->mounts[$xa_count]['audio_samplerate'] =
itsdragonstyle 24-09-2009, 14:29 $x_vals[$x_index['AUDIO_SAMPLERATE'][$xa_count]]['value'];
$this->mounts[$xa_count]['bitrate'] = $x_vals[$x_index['BITRATE'][$xa_count]]['value'];
$this->mounts[$xa_count]['genre'] = $x_vals[$x_index['GENRE'][$xa_count]]['value'];
$this->mounts[$xa_count]['ice-bitrate'] = $x_vals[$x_index['ICE-BITRATE'][$xa_count]]['value'];
$this->mounts[$xa_count]['ice-channels'] = $x_vals[$x_index['ICE-CHANNELS'][$xa_count]]['value'];
$this->mounts[$xa_count]['ice-quality'] = $x_vals[$x_index['ICE-QUALITY'][$xa_count]]['value'];
$this->mounts[$xa_count]['ice-samplerate'] = $x_vals[$x_index['ICE-SAMPLERATE'][$xa_count]]['value'];
$this->mounts[$xa_count]['listeners'] = $x_vals[$x_index['LISTENERS'][$xa_count]]['value'];
$this->mounts[$xa_count]['listenurl'] = $x_vals[$x_index['LISTENURL'][$xa_count]]['value'];
$this->mounts[$xa_count]['public'] = $x_vals[$x_index['PUBLIC'][$xa_count]]['value'];
$this->mounts[$xa_count]['server_description'] = $x_vals[$x_index['SERVER_DESCRIPTION'][$xa_count]]['value'];
$this->mounts[$xa_count]['server_name'] = $x_vals[$x_index['SERVER_NAME'][$xa_count]]['value'];
$this->mounts[$xa_count]['server_url'] = $x_vals[$x_index['SERVER_URL'][$xa_count]]['value'];
$this->mounts[$xa_count]['subtype'] = $x_vals[$x_index['SUBTYPE'][$xa_count]]['value'];
$this->mounts[$xa_count]['title'] = $x_vals[$x_index['TITLE'][$xa_count]]['value'];
if($this->mounts[$xa_count]['artist'] == ""){
$artist = explode(" - ", $this->mounts[$xa_count]['title']);
$this->mounts[$xa_count]['artist'] = $artist[0];
$this->mounts[$xa_count]['title'] = $artist[1];
}
$xa_count++;
}
$x_count++;
}
if($this->mounts[0]['mount'] != ""){
$this->mount['mount'] = $x_vals[$x_index['SOURCE'][0]]['attributes']['MOUNT'];
$this->mount['artist'] = $x_vals[$x_index['ARTIST'][0]]['value'];
$this->mount['audio_bitrate'] = $x_vals[$x_index['AUDIO_BITRATE'][0]]['value'];
$this->mount['audio_channels'] = $x_vals[$x_index['AUDIO_CHANNELS'][0]]['value'];
$this->mount['audio_info'] = $x_vals[$x_index['AUDIO_INFO'][0]]['value'];
$this->mount['audio_samplerate'] = $x_vals[$x_index['AUDIO_SAMPLERATE'][0]]['value'];
$this->mount['bitrate'] = $x_vals[$x_index['BITRATE'][0]]['value'];
$this->mount['genre'] = $x_vals[$x_index['GENRE'][0]]['value'];
$this->mount['ice-bitrate'] = $x_vals[$x_index['ICE-BITRATE'][0]]['value'];
$this->mount['ice-channels'] = $x_vals[$x_index['ICE-CHANNELS'][0]]['value'];
$this->mount['ice-quality'] = $x_vals[$x_index['ICE-QUALITY'][0]]['value'];
$this->mount['ice-samplerate'] = $x_vals[$x_index['ICE-SAMPLERATE'][0]]['value'];
$this->mount['listeners'] = $x_vals[$x_index['LISTENERS'][0]]['value'];
$this->mount['listenurl'] = $x_vals[$x_index['LISTENURL'][0]]['value'];
$this->mount['public'] = $x_vals[$x_index['PUBLIC'][0]]['value'];
$this->mount['server_description'] = $x_vals[$x_index['SERVER_DESCRIPTION'][0]]['value'];
$this->mount['server_name'] = $x_vals[$x_index['SERVER_NAME'][0]]['value'];
$this->mount['server_url'] = $x_vals[$x_index['SERVER_URL'][0]]['value'];
$this->mount['subtype'] = $x_vals[$x_index['SUBTYPE'][0]]['value'];
$this->mount['title'] = $x_vals[$x_index['TITLE'][$xa_count]]['value'];
}
else{
unset($this->mount);
$this->mount['mount'] = "N/A";
}
$this->version = $x_vals[$x_index['SERVER'][0]]['value'];
$this->current_listeners = $x_vals[$x_index['LISTENERS'][0]]['value'];
}
else
die('There is no Server selected. Please select \"shoutcast\" or \"icecast\".');
}
function listeners(){
foreach($this->x_index['LISTENERS'] as $listener){
if($this->x_vals[$listener]['type'] == "close" || $this->x_vals[$listener + 2]['value'] == "\n" || $this->x_vals[$listener + 2]['value'] == "")
break;
$this->listener_array .= array( "hostname" => $this->x_vals[$listener + 2]['value'],
"useragent" => $this->x_vals[$listener + 4]['value'],
"underruns" => $this->x_vals[$listener + 6]['value'],
"connect_time" => $this->x_vals[$listener + 8]['value'],
"pointer" => $this->x_vals[$listener + 10]['value'],
"uid" => $this->x_vals[$listener + 12]['value']);
}
}
function song_history(){
$x_array = count($this->x_index['SONG']);
$x_array_count = 0;
for($x_count = 0; $x_count < $x_array; $x_count += 2){
$x_song_ = $this->x_vals[$this->x_index['SONG'][$x_count] + 2]['value'];
$x_song = explode(" - ", $x_song_);
$this->song_history[$x_array_count++] = array("time" => date($this->timeformat, $this->x_vals[$this->x_index['SONG'][$x_count] + 1]['value']),
"artist" => $x_song[0],
"title" => $x_song[1]);
}
}
function value($x_nodename){
return $this->x_vals[$this->x_index[$x_nodename][0]]['value'];
}
function time_format($x_timeformat){
$this->timeformat = $x_timeformat;
}
}
?>
Weiter gehts dann mit der xml_shoutcast:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/transitional.dtd">
<html>
<head>
<title>Dragonland-Radio - Dein Radiosender im Internet (http://www.Dragonland-radio.de) - Dein Radio im Internet. That's Cool! Hier findest du unsere Playlist!</title>
<style>
body {
font-family: Tahoma, Verdana, Arial;
color: #FFFFA0;
background-color: #2a2b3c;
margin-top: 20px;
margin-bottom: 20px;
font-weight: bold;
}
a {
text-decoration: none;
color: white;
}
a:hover {
text-decoration: underline;
}
table {
color: #FFFFA0;
}
#overall {
width: 600px;
margin-left: 100px;
}
.text {
font-size: 12px;
font-weight: normal;
}
.heading {
font-size: 18px;
}
.big_text {
font-size: 30px;
text-align: center;
width: 100%;
}
</style>
</head>
<body>
<?php
include("radio.class.php"); // Klasse einbinden
$radio = new Radio; // Klasse initialisieren
$radio->set_host("dragonland-radio.de"); // ServerURL
$radio->set_port("8000"); // Serverport
$radio->set_pass("*****"); // Passwort für den Adminbereich des Servers
$radio->set_serv("shoutcast"); // Legt die Serversoftware fest: "icecast" oder "shoutcast"
$radio->time_format("d.m.Y - H:i:s");
// Datumsformat festlegen. Beispiele unter PHP: date - Manual (http://de2.php.net/manual/de/function.date.php)
$radio->init(); // Statistik initialisieren
if($radio->status == 1){ // 1 -> Sendung läuft, 0-> keine Sendung
?>
<br />
<div align="center"><p class="heading">Aktueller Song</p></div>
<table align="center" width="600" cellpadding="8" cellspacing="0" border="1" bordercolor="#b74990">
<tr>
<td bgcolor="#292aa9">
<div class="text">Interpret</div><br> <?php echo $radio->artist;?><br />
<br />
<div class="text">Titel</div><br> <?php echo $radio->title;?><br />
<br />
<div class="text">Song URL</div><br> <?php echo $radio->song_url;?><br />
</td>
</tr>
</table>
<br /><br />
</td>
</tr><br>
</table>
<?php
/********** Song History **********/
if(is_array($radio->song_history)){ // Nur anzeigen, wenn Songs in der History sind
?>
<p class="heading">Song History</p>
<table align="center" width="90%" cellpadding="8" cellspacing="0" border="1" bordercolor="#707070">
<tr>
<td bgcolor="#002040">
<div class="text">
song_history[]['artist'] -> Interpret<br />
song_history[]['title'] -> Titel<br />
song_history[]['time'] -> Sendezeit<br />
</div><hr />
<?php
foreach($radio->song_history as $song_history){
?>
<div class="text">Interpret</div><?php echo $song_history['artist'];?><br />
<div class="text">Song</div><?php echo $song_history['title'];?><br />
<div class="text">Sendezeit</div><?php echo $song_history['time'];?>
<hr />
<?php
}
?>
</td>
</tr>
</table>
<?php
}
}
else
echo "Momentan keine Sendung";
?>
<p align="right">© in 2009 by <a href="" target="_blank">DH-Design</a></p>
</div>
</body>
</html>
Nun bekomm ich folgende Fehlermeldung:
Fatal error: Call to undefined method radio::time_format() in /var/www/vhosts/dragonland-radio.de/subdomains/hp/httpdocs/playlist.php on line 56
AmicaNoctis 24-09-2009, 14:36 Hallo,
für PHP-Quelltext gibt es den PHP-Button, bitte ändern.
Nun bekomm ich folgende Fehlermeldung:
Fatal error: Call to undefined method radio::time_format() in /var/www/vhosts/dragonland-radio.de/subdomains/hp/httpdocs/playlist.php on line 56
Postest du die bitte (mit PHP Tags!), denn das scheint die wichtigste zu sein.
$radio->set_pass("[entfernt, Amica]"); // Passwort für den Adminbereich des Servers
Willst du das nicht lieber rausnehmen?
Gruß,
Amica
itsdragonstyle 24-09-2009, 15:03 Die playlist.php ist die selbe wie xml_shoutcast.php nur umbenannt....
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/transitional.dtd">
<html>
<head>
<title>http://www.Dragonland-radio.de - Dein Radio im Internet. That's Cool! Hier findest du unsere Playlist!</title>
<style>
body {
font-family: Tahoma, Verdana, Arial;
color: #FFFFA0;
background-color: #2a2b3c;
margin-top: 20px;
margin-bottom: 20px;
font-weight: bold;
}
a {
text-decoration: none;
color: white;
}
a:hover {
text-decoration: underline;
}
table {
color: #FFFFA0;
}
#overall {
width: 600px;
margin-left: 100px;
}
.text {
font-size: 12px;
font-weight: normal;
}
.heading {
font-size: 18px;
}
.big_text {
font-size: 30px;
text-align: center;
width: 100%;
}
</style>
</head>
<body>
<?php
include("radio.class.php"); // Klasse einbinden
$radio = new Radio; // Klasse initialisieren
$radio->set_host("dragonland-radio.de"); // ServerURL
$radio->set_port("8000"); // Serverport
$radio->set_pass("******"); // Passwort für den Adminbereich des Servers
$radio->set_serv("shoutcast"); // Legt die Serversoftware fest: "icecast" oder "shoutcast"
$radio->time_format("d.m.Y - H:i:s");
// Datumsformat festlegen. Beispiele unter http://de2.php.net/manual/de/function.date.php
$radio->init(); // Statistik initialisieren
if($radio->status == 1){ // 1 -> Sendung läuft, 0-> keine Sendung
?>
<br />
<div align="center"><p class="heading">Aktueller Song</p></div>
<table align="center" width="600" cellpadding="8" cellspacing="0" border="1" bordercolor="#b74990">
<tr>
<td bgcolor="#292aa9">
<div class="text">Interpret</div><br> <?php echo $radio->artist;?><br />
<br />
<div class="text">Titel</div><br> <?php echo $radio->title;?><br />
<br />
<div class="text">Song URL</div><br> <?php echo $radio->song_url;?><br />
</td>
</tr>
</table>
<br /><br />
</td>
</tr><br>
</table>
<?php
/********** Song History **********/
if(is_array($radio->song_history)){ // Nur anzeigen, wenn Songs in der History sind
?>
<p class="heading">Song History</p>
<table align="center" width="90%" cellpadding="8" cellspacing="0" border="1" bordercolor="#707070">
<tr>
<td bgcolor="#002040">
<div class="text">
song_history[]['artist'] -> Interpret<br />
song_history[]['title'] -> Titel<br />
song_history[]['time'] -> Sendezeit<br />
</div><hr />
<?php
foreach($radio->song_history as $song_history){
?>
<div class="text">Interpret</div><?php echo $song_history['artist'];?><br />
<div class="text">Song</div><?php echo $song_history['title'];?><br />
<div class="text">Sendezeit</div><?php echo $song_history['time'];?>
<hr />
<?php
}
?>
</td>
</tr>
</table>
<?php
}
}
else
echo "Momentan keine Sendung";
?>
<p align="right">© in 2005-2006 by <a href="http://www.DH-Design.de" target="_blank">DH-Design </a></p>
</div>
</body>
</html>
AmicaNoctis 24-09-2009, 15:13 include("radio.class.php");
Dann benutzt du vermutlich die falsche Klasse. Gibt es noch eine, die so heißt? Oder umbenannt wurde? Oder in einem anderen Verzeichnis liegt?
Gruß,
Amica
itsdragonstyle 24-09-2009, 15:17 rofl
Dummheit muss bestraft werden *lach*
AmicaNoctis 24-09-2009, 15:21 rofl
Dummheit muss bestraft werden *lach*
Ich vermute mal, dass es jetzt geht? :)
itsdragonstyle 24-09-2009, 15:25 jap, drinnen isse xD
http://www.Dragonland-radio.de - Dein Radio im Internet. That's Cool! Hier findest du unsere Playlist! (http://hp.dragonland-radio.de/radio_stats/playlist.php)
nur wird mir jetzt die sendezeit warum auch immer nicht mehr angezeigt ^^
AmicaNoctis 24-09-2009, 15:37 nur wird mir jetzt die sendezeit warum auch immer nicht mehr angezeigt ^^
Hast du Zeile 98 verändert? Die muss so aussehen:
<div class="text">Sendezeit</div><?php echo $song_history['time'];?>
itsdragonstyle 24-09-2009, 15:44 Super, danke ;)
Funktioniert :))
|
|