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 

Winamp ne lit pas.
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Forum Francophone
View previous topic :: View next topic  
Author Message
jcr
Modérateur français
Modérateur français


Joined: 14 Apr 2006
Posts: 544
Location: France, Auvergne

PostPosted: Fri Nov 27, 2009 2:42 pm    Post subject: Reply with quote

en relisant le code, corriges:
Code:
   public function getServerInfo()
   {
      $data = '' ;
      $fp = $this->serverConnect() ;
      if ( $fp ) {
         if ( $fp['Status'] == 'Offline' ) {
            $data = 'Radio Offline' ;
         } else {
            // feel free to add other things in HtmlResponse service call
            $data = $this->setHtmlResponse( $fp['Listeners'], $fp['Title'] ) ;
         }
      } else {
         $data = "Icecast Server Unavailable. Reason: $this->errno, $this->errstr" ;
      }
      return $data
   } // getServerInfo

il manquait une accolade fermante.
_________________
Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nanou



Joined: 24 Nov 2009
Posts: 30

PostPosted: Fri Nov 27, 2009 2:55 pm    Post subject: Reply with quote

oui je sais que ces un php écrit vite mais je me plains pas ! hahhaha......

voici la ligne en quesiton :

} else {
$data = "Icecast Server Unavailable. Reason: $this->errno, $this->errstr" ;

si le serveur n'est pas disponible, écrire le numéro d'Erreur et la chaine de caractere correspondante...enfin, je pense que c'est cela ! lolll

Merci.
Back to top
View user's profile Send private message
jcr
Modérateur français
Modérateur français


Joined: 14 Apr 2006
Posts: 544
Location: France, Auvergne

PostPosted: Fri Nov 27, 2009 3:14 pm    Post subject: Reply with quote

Oui, juste avant le else, il manque une accolade fermante, qu el'indentation du code montre bien. La correction a été postée aussi Smile
_________________
Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nanou



Joined: 24 Nov 2009
Posts: 30

PostPosted: Fri Nov 27, 2009 4:05 pm    Post subject: Reply with quote

Encore une erreur lollllll

Parse error: syntax error, unexpected '}' in /home/sites/xxxxx/xxxxx/public_html/Radio/Radiobox.php on line 70

la ligne 70 :

return $data
} // getServerInfo

J'ai essayer d'y rajouter une accolade fermante sur la ligne getserverinfo la...mais j'ai toujours la meme erreur encore.
Back to top
View user's profile Send private message
jcr
Modérateur français
Modérateur français


Joined: 14 Apr 2006
Posts: 544
Location: France, Auvergne

PostPosted: Fri Nov 27, 2009 4:25 pm    Post subject: Reply with quote

regardes bien le code, en suivant les indentations, avec un éditeur à coloration syntaxique, par exemple kwrite (sous linux) ou notepad++.
_________________
Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nanou



Joined: 24 Nov 2009
Posts: 30

PostPosted: Fri Nov 27, 2009 4:43 pm    Post subject: Reply with quote

oui oui je regarde et je regarde....je vois 5 accolades ouvertes et 5 fermées donc le compte est bon...dans le script qui as été posté (corrigé). Donc, ou est l'erreur ? je cherche et je cherche...

suis vraiment désolé d'importuné avec tout ca mais vous etes ma seul ressource Smile , j'apprécie énormément votre aide.
Back to top
View user's profile Send private message
jcr
Modérateur français
Modérateur français


Joined: 14 Apr 2006
Posts: 544
Location: France, Auvergne

PostPosted: Fri Nov 27, 2009 6:00 pm    Post subject: Reply with quote

Bon, rentré du boulot, j'ai pris le temps d etester... Voilà, version 100% débugguée Smile
Code:
<?php
/**
* Sample icecast status querying from PHP
*
* This is only a very simple sample.
* When you have multiple mounts, you should extend on it.
*
* Use more info from status2.xsl if needed.
* This is a very basic display, you'll have to create your own look and feel
* and add eventual JQuerry, Mootools or other javascript in a RESTFUL environment
* to allow auto refresh.
*/

/**
* Connection parameters helper class
* Please fill in the blanks here
*/
class icecastParams
{
   public $host = '' ; // Your Icecast host name or IP
   public $port = '' ; // Your icecast Port
} // class icecastParams

/**
* Main icecast connection and data management
*
* This should be modified according to your needs.
* It's only a guideline on how to talk with icecast xsl based services.
*/
class icecastClient
{
   private $p = null ;         // Server parameters
   private $errstr = '' ;      // socket Error string
   private $errno = '' ;      // socket Error number
   private $number = '10' ;   // socket timeout

   /**
   * Creates an instance of icecastClient
   */
   public function __construct()
   {
      $this->p = new icecastParams() ;
      if ( empty( $this->p->host ) ) {
         throw new Exception( 'Please setup your icecast host name' ) ;
      }
      if ( empty( $this->p->port ) ) {
         throw new Exception( 'Please setup your icecast access port' ) ;
      }
   } // __construct

   /**
   * Main method, Connects to icecast, grabs info and build response.
   * @return Response string
   */
   public function getServerInfo()
   {
      $data = '' ;
      $fp = $this->serverConnect() ;
      if ( $fp ) {
         if ( $fp['Status'] == 'Offline' ) {
            $data = 'Radio Offline' ;
         } else {
            // feel free to add other things in HtmlResponse service call
            $data = $this->setHtmlResponse( $fp['Listeners'], $fp['Title'] ) ;
         }
      } else {
         $data = "Icecast Server Unavailable. Reason: $this->errno, $this->errstr" ;
      }
      return $data ;
   } // getServerInfo

   /**
   * Connects to icecast server and grabs
   *
   * @return Array with information about service
   */
   private function serverConnect()
   {
      $fp = @fsockopen( $this->p->host, $this->p->port, $this->errno, $this->errstr, $this->number ) ;
      if ( !$fp )
         return false ;
      $data = '' ;
      fputs( $fp, "GET /status2.xsl HTTP/1.1\nUser-Agent:Mozilla\n\n" ) ; // grab status2.xsl
      if ( !feof($fp ) ) {
         $data = fread( $fp, 31337 ) ;
         usleep( 500000 ) ;
      }
      fclose( $fp ) ;
      $status = empty( $data) ? 0 : 1 ; // if no data, nothing to listen to...
      if ( $status == 0 ) {
         return array( 'Status' => 'Offline' ) ;
      }
      $atmp = explode( "\n", $data ) ;
      // if junk data is shown, uncomment next line to get info via dump and give good indice.
      //echo "<pre>" ; var_dump( $atmp ) ; echo "</pre>============\n" ;
      $data = $atmp[9] ; // Note: indice may vary depending on your settings. See dump for fitting.
      $data = explode( ',', $data ) ;
      return array( 'Status' => 'Online',
                 'MountPoint' => $data[0],
                 'Listeners' => $data[3],
                 'Title' => $data[5] ) ;

   } // serverConnect

   /**
   * Very basic Htlm response, you should change it according to your needs
   */
   private function setHtmlResponse( $listeners, $title ) {
      return 'Listeners: ' . $listeners . '<br />Title: ' . $title . '<br />' ;
   }

} // class icecastClient

// test code
$radio = new icecastClient() ;
echo $radio->getServerInfo() ;

_________________
Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nanou



Joined: 24 Nov 2009
Posts: 30

PostPosted: Fri Nov 27, 2009 9:04 pm    Post subject: Reply with quote

Merci beaucoup, le php fonctionne bensur Smile

Là, je dois trouver comment changer l'aspect de la page recue. Des tests, que des tests...lolllll

Ben aprécié ! Merci encore !

Bonne Journée !
Back to top
View user's profile Send private message
jcr
Modérateur français
Modérateur français


Joined: 14 Apr 2006
Posts: 544
Location: France, Auvergne

PostPosted: Fri Nov 27, 2009 9:09 pm    Post subject: Reply with quote

Pour changer le look, modifies la méthode setHtmlResponse Smile

Tu peux y mettre tout ce que tu veux en HTML Smile
_________________
Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nanou



Joined: 24 Nov 2009
Posts: 30

PostPosted: Fri Nov 27, 2009 9:16 pm    Post subject: Reply with quote

ok oui mais ....eee...je sais pas si t'as remarquer mais....JE SUIS NUL ! ahhhh quel honte ! lolllll

ok dans ma tete j'me dit, voila , c'est simple, mettre du html alors ok voici :

/**
* Very basic Htlm response, you should change it according to your needs
*/
<html>
<head>
<title>Ma Foutu Radio</title>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="Nanou©">
<meta name="generator" content="">
</head>
<body>
<CENTER>

private function setHtmlResponse( $listeners, $title ) {
return 'Listeners: ' . $listeners . '<br />Title: ' . $title . '<br />' ;

</CENTER>
</body>
</html>
}


J'ai comme l'impression que j'suis dans la bouette jusqu'au coup mais j'm'essaye lolllll

Smile
Back to top
View user's profile Send private message
jcr
Modérateur français
Modérateur français


Joined: 14 Apr 2006
Posts: 544
Location: France, Auvergne

PostPosted: Fri Nov 27, 2009 9:31 pm    Post subject: Reply with quote

Tu ne mets pas le <html>, etc.. juste le contenu du body Smile
_________________
Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nanou



Joined: 24 Nov 2009
Posts: 30

PostPosted: Fri Nov 27, 2009 9:33 pm    Post subject: Reply with quote

Ok mais si je veut un arriere plan ? changer la couleur des textes ? etc... Je laisse le tag BODY a /BODY et tout entre ?
Back to top
View user's profile Send private message
jcr
Modérateur français
Modérateur français


Joined: 14 Apr 2006
Posts: 544
Location: France, Auvergne

PostPosted: Fri Nov 27, 2009 9:38 pm    Post subject: Reply with quote

Utilises une feuile de style CSS..
c'est fait pour Smile
_________________
Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nanou



Joined: 24 Nov 2009
Posts: 30

PostPosted: Fri Nov 27, 2009 9:47 pm    Post subject: Reply with quote

Comme Ca ??

/**
* Very basic Htlm response, you should change it according to your needs
*/
<body>
<CENTER>
<link rel="stylesheet" type="text/css" href="mafeuilledestyle.css" />

private function setHtmlResponse( $listeners, $title ) {
return 'Listeners: ' . $listeners . '<br />Title: ' . $title . '<br />' ;

</CENTER>
</body>
}


Razz
Back to top
View user's profile Send private message
jcr
Modérateur français
Modérateur français


Joined: 14 Apr 2006
Posts: 544
Location: France, Auvergne

PostPosted: Fri Nov 27, 2009 10:08 pm    Post subject: Reply with quote

Attention, ton code doit être dans la fonction setHtmlResponse..
ce qui ets donné est une classe PHP. regardes bien les 2 lignes en bas de code qui donnent un exemple d'utilisation.
_________________
Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Forum Francophone All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 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