Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Now playing in web page
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
jasonrhl



Joined: 03 Jan 2008
Posts: 18

PostPosted: Sat Mar 29, 2008 3:27 am    Post subject: Reply with quote

Ok I worked out how to get it to work if you are having problems http_get() and curl.

Someone may be able to clean code up a bit because im no programmer. Just managed to find an example that worked for me to replace http_get


Code:
<?php
# Don't allow direct acces to the file
# mamboserver/Joomla specific
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
 
$radioname = 'WEBRADIO' ;  // Your radio name here
$host = 'webradio.servemp3.com' ; // Icecast host to connect to
$port = '8000' ;  // Icecast port
$pic = 'Play webstream';  // 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.webradio.com/modules/icecast/listen.m3u">' . $pic . '</a><br />'; // Direct listen to us link



/**
 * 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;   
}

#usage:
$msg = get_content ("http://webradio.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( "\n", $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] ;
   }
}
// Get Fallback playlist information first...
$curtitle = $stations[$djrobot]['Title'] ;
$curartist = $stations[$djrobot]['Artist'] ;
$listeners = $stations[jrobot]['Listeners'] ;
$peak = $stations[$djrobot]['Peak'] ;
$stream = $stations[$djrobot]['Name'] ;
echo $listen . "\n" ;
if ( !empty( $stations[$realdj]['Name'] ) ) {
   $curtitle = $stations[$realdj]['Title'] ;
   $curartist = $stations[$realdj]['Artist'] ;
   $peak = $stations[$realdj]['Peak'] ;
   $stream = str_replace( 'on FlyDance', '', $stations[$realdj]['Name'] ) ;
}
// Sanitize information, just for being sure it looks nice

$curtitle = str_replace( '_', '', $curtitle ) ;
$curartist = str_replace( '_', '', $curartist ) ;
echo "DJ: <strong>$stream</strong><br />" ;
echo "$curartist<br />" ;
?>

  </center> <br/>
</div>
Back to top
View user's profile Send private message
jasonrhl



Joined: 03 Jan 2008
Posts: 18

PostPosted: Sat Mar 29, 2008 11:06 pm    Post subject: Reply with quote

I now have a module for joomla that will update the station info without the page being reloaded.

I will look in to wordpress as well.

I know this will be unpopular but i would like a small donation if you want a copy of the code. It will just help us to make more things later on for joomla.
Back to top
View user's profile Send private message
razametal



Joined: 03 Nov 2006
Posts: 24
Location: Manta - Ecuador

PostPosted: Sat Feb 07, 2009 1:28 am    Post subject: Reply with quote

Have you the code for wordpress?
_________________
Only The Good Die Young
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber