Jump to content

I can not work out why I get internet explorer crashes and errors icecast php


jasonrhl

Recommended Posts

Hi I hope someone here can help me out.

 

I have 2 problems the first is that the code never refreshes the track name when it changes it still needs a page refresh.

 

Secondly I get an error. You will need to register to get to that error. If you need to access that page tell me and I will set up a user account for people to use to view.

 

Webpage error details

 

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

Timestamp: Wed, 17 Jun 2009 22:52:51 UTC

 

 

Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)

Line: 0

Char: 0

Code: 0

URI: http://www.stonecoldbush.com/component/option,com_community/Itemid,46/userid,62/view,profile/

 

 

 

<?php
global $radioname, $host, $port, $pic, $djrobot, $realdj, $listen;

$radioname = 'JFRADIO' ;  // Your radio name here
$host = 'jfradio.servemp3.com' ; // Icecast host to connect to
$port = '8000' ;  // Icecast port
$pic = '<img src="/modules/headset.jpeg" alt="listen" />';  // This sis the Listen to the radio icon
$djrobot = '/listen'; // Our playlist fallback mount..
$realdj = '/dj1' ; // On air DJ stream
$listen = '<a href="http://www.stonecoldbush.com/modules/icecast/listen.m3u">LISTEN</a> ' . $pic . '' ; // Direct listen to us link
//$er = ini_set('error_reporting', 0);
/**
* Lab Radio
*/
// Get server stream status...
function get_content($url)
{
    $ch = curl_init();

    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_HEADER, 0);

    ob_start();

    curl_exec ($ch);
    curl_close ($ch);
    $string = ob_get_contents();

    ob_end_clean();
   
    return $string;    
}

function get_data()
{
global $radioname, $host, $port, $pic, $djrobot, $realdj, $listen;
#usage:
$msg = get_content ("http://jfradio.servemp3.com:8000/getradiostatus.xsl");

//$msg = http_get( "http://$host:$port/getradiostatus.xsl" ) ;
// Clean up response and fill an array with active streams.
$spl = explode( '<pre>', $msg ) ;
$spl = str_replace( '</pre>', '', $spl[1] ) ;
$spl = explode( "<br/>", $spl ) ;
$flds = $spl[0] ;
$spl = explode( "
", $flds ) ;
array_shift( $spl ) ;
// Build stations information.
$stations = array() ;
foreach ( $spl as $e ) {
   if ( ( $e !== '_END_' ) && !empty( $e ) ) {
               // Only for valid stations, reject empty and marker tags
      $p = explode( '|', $e ) ;
      $stations[$p[0]]['Name'] = @$p[1] ;
      $stations[$p[0]]['Description'] = @$p[2] ;
      $stations[$p[0]]['Listeners'] = @$p[9] ;
      $stations[$p[0]]['Peak'] = @$p[10] ;
      $stations[$p[0]]['Artist'] = @$p[14] ;
      $stations[$p[0]]['Title'] = @$p[13] ;
   }
}
$response = new stdClass();
// Get Fallback playlist information first...
$response->curtitle = $stations[$djrobot]['Title'] ;
$response->curartist = $stations[$djrobot]['Artist'] ;
$response->listeners = $stations[$djrobot]['Listeners'] ;
$response->peak = $stations[$djrobot]['Peak'] ;
$response->stream = $stations[$djrobot]['Name'] ;
if ( !empty( $stations[$realdj]['Name'] ) ) {
   $response->curtitle = $stations[$realdj]['Title'] ;
   $response->curartist = $stations[$realdj]['Artist'] ;
   $response->peak = $stations[$realdj]['Peak'] ;
   $response->stream = str_replace( 'on JFRadio', '', $stations[$realdj]['Name'] ) ;
}
// Sanitize information, just for being sure it looks nice

$response->curtitle = str_replace( '_', '', $response->curtitle ) ;
$response->curlist = str_replace( '_', '', $response->curartist ) ;
return $response;
}

if (defined( '_VALID_MOS' )) {

//	echo $listen ."<img src=\"/modules/headset.jpeg\">"  ;
$response = get_data();
echo "   <div id=\"artist\" style=\"opacity:0.6;filter: alpha(opacity = 60);background-color:#FFFFFF;font-size:12px;zoom: 1\" ><font color=\"#C7A317\"><b>
$response->stream</b></font> <strong>$listen</strong> <font color=\"#000000\"> $response->curartist</font></div></br>" ;	


?>





<script type="text/javascript">
var req = new XMLHttpRequest();

myHandler = function() {
if (req.readyState == 4 /*complete*/) {
	var stream = document.getElementById('streamname');
	var artist = document.getElementById('artistname');
	var response = eval('(' + req.responseText + ')');
	stream.innerHTML = response.stream;
	artist.innerHTML = response.curartist;
	window.setTimeout(icecastUpdate, 5000);
   }
}

icecastUpdate = function() {
req.open("GET", "modules/mod_icecast.php", /*async*/true);
req.onreadystatechange = myHandler;
req.send(/*no params*/null);
}

window.setTimeout(icecastUpdate, 25000);

//--></script>

<?php

} else { // Ajax
echo json_encode(get_data());
exit;
}
//ini_set('error_reporting', $er);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.