this is the last one i tryed to use
/*--------------------------------------------------
DACstreamstats: retriever.php
Written by Hercules Avello
--------------------------------------------------*/
// ----------------------- Config ----------------------
// Fill in this information with your own
$title = "Psychohazard"; // Ex: Psychohazard
$url = "**.34.***.25"; // Ex: **.34.***.25
$port = "8***"; // Ex: 8***
// -----------------------------------------------------
if ($open = @fsockopen($url,$port)) {
fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
$read = fread($open,1000);
$row = explode("content-type:text/html",$read);
$row = explode(",",$row [1]);
}
// create doctype
$dom = new DOMDocument("1.0");
$row[6] = substr($row[6], 0, -14);
// display document in browser as plain text
header("Content-Type: text/xml");
// root
$root = $dom->createElement("shoutcast");
$dom->appendChild($root);
// title
$item = $dom->createElement("title");
$root->appendChild($item);
$text = $dom->createTextNode($title);
$item->appendChild($text);
// url -
http://ipaddress:port/;stream.nsv$item = $dom->createElement("url");
$root->appendChild($item);
$text = $dom->createTextNode('http://'.$url.':'.$port);
$item->appendChild($text);
// currentListeners
$item = $dom->createElement("currentListeners");
$root->appendChild($item);
$text = $dom->createTextNode($row[4]);
$item->appendChild($text);
// maxListeners
$item = $dom->createElement("maxListeners");
$root->appendChild($item);
$text = $dom->createTextNode($row[3]);
$item->appendChild($text);
// bitrate
$item = $dom->createElement("bitrate");
$root->appendChild($item);
$text = $dom->createTextNode($row[5]);
$item->appendChild($text);
// currentSong
$item = $dom->createElement("currentSong");
$root->appendChild($item);
$text = $dom->createTextNode($row[6]);
$item->appendChild($text);
// status online/offilne
$item = $dom->createElement("status");
$root->appendChild($item);
$status = 'Offline';
if($row[1] == 1)
$status = 'Online';
$text = $dom->createTextNode($status);
$item->appendChild($text);
// If the song tags are formatted correctly,
// also show an "artist" and "title"
if(substr_count($row[6], ' - '))
{
$info = explode(' - ', $row[6]);
$song = $info[1];
$artist = $info[0];
$item = $dom->createElement("artist");
$root->appendChild($item);
$text = $dom->createTextNode($artist);
$item->appendChild($text);
$item = $dom->createElement("songTitle");
$root->appendChild($item);
$text = $dom->createTextNode($song);
$item->appendChild($text);
}
// display
echo $dom->saveXML();
?>