i have little problem with XML. My XML file is look like this:
http://pastebin.com/MQUB2W2B i user pastebin because this site don't support xml code.. ://
so i need to select source mount "/stream" and other source mount "/". And my PHP code look like this:
Class stream {
Public Function __construct($host, $path, $user, $pass, $mpoint){
$this->host = $host;
$this->path = $path;
$this->user = $user;
$this->password = $pass;
$this->mpoint = $mpoint;
$this->url = "http://{$this->user}:{$this->password}@{$this->host}/{$this->path}";
$this->xml = simplexml_load_file($this->url);
}
Public Function audio($url, $format){
return print "<audio controls> <source src=\"{$url}\" type=\"audio/{$format}\"> </audio>";
}
Public Function stream_meta(){
$xml = $this->xml->registerXPathNamespace('test', '/{$this->mpoint}');
$result = $xml->xpath('test:artist');
return $result;
}
Public Function nowplay(){
return $this->xml->source[0]->artist;
}
Public Function download($format){
$link = "http://{$this->host}/{$this->mpoint}";
if($format == "m3u"){
return "{$link}.m3u";
}
elseif($format == "xspf"){
return "{$link}.xspf";
}
elseif($format == "vclt"){
return "{$link}.vclt";
}
return false;
}
}
So now i asking what i do wrong or what i can do better? i need to select artist data and know what is the source mount "?what is this?". I really need help. I don't know what i can do and i don't invent other way to do this. I am so tired and i am really need help! Please, can anyone help me? I don't want to use "nowplay()" function. because source mount "/example" change sometimes...