ValidateEmptyString($this->server_titel); }
public function getServerGenre() { return $this->ValidateEmptyString($this->server_genre); }
public function getServerUrl() { return $this->ValidateEmptyString($this->server_url); }
public function getListenerPeak() { return $this->ValidateEmptyString($this->listener_peak); }
public function getServerStatusFormatted() { return $this->stream_status == 1 ? „Online“ : „Offline„; }
public function getServerStatus() { return $this->stream_status; }
public function getListener() { return $this->listener; }
public function getMaxListener() { return $this->maxListener; }
public function getSongTitel() { return $this->ValidateEmptyString($this->song_titel); }
public function getListener() { return $this->listener; }
public function getSongs() { return $this->songs; }
public function getDetailedInfos() { return $this->detailedinfos; }
/* Set Methods */
public function setDetailedInfos($value) { $this->detailedinfos = (bool)$value; }
public function __construct($host, $port, $pw)
{
$xml = “;
$fp = fsockopen($host, $port, $errno, $errstr, 5);
$send = „GET /admin.cgi?pass=$pw&mode=viewxml&page=0 HTTP/1.1\r\n“
. „Host: $host:$port\r\n“
. „User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)\r\n“
. „Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n“
. „Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3\r\n“
. „Accept-Encoding: gzip,deflate\r\n“
. „Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n“
. „Keep-Alive: 300\r\n“
. „Connection: keep-alive\r\n\r\n“;
fwrite($fp, $send);
while(!feof($fp))
{
$xml .= fgets($fp, 1024);
}
fclose($fp);
$this->xml = $xml;
$this->setVars();
$this->generateListener();
$this->generateSongHistroy();
}
private function between($von, $bis ,$string )
{
$a = explode($von, $string);
$b = explode($bis, $a[1]);
return $b[0];
}
private function ValidateEmptyString($string)
{
$input = (string)$string;
if($input != „“){
return $input;
}
else{
return „n/a“;
}
}
private function setVars()
{
$this->server_titel = $this->between(„
$this->server_genre = $this->between(„
$this->server_url = $this->between(„
$this->listener_peak = $this->between(„
$this->stream_status = (int)$this->between(„
$this->listener = (int)$this->between(„
$this->maxListener = (int)$this->between(„
$this->song_titel = $this->between(„
}
private function generateListener()
{
$l = explode(„
foreach($l as $listener) {
if($this->between(„
array_push($this->listeners, array(
„ip“ => $this->between(„
„client“ => $this->between(„
„verbindungsdauer“ => $this->between(„
);
}
}
}
private function generateSongHistroy()
{
$s = explode(„
foreach($s as $song) {
if($this->between(„
array_push($this->songs, array(
„abspielzeit“ => $this->between(„
„titel“ => $this->between(„
);
}
}
}
}
?>


