Manuel Pear

Net_NNTP::getGroups()

Net_NNTP::getGroups() -- fetch list of avaible newsgroups

Synopsis

  1. <?php
  2. require_once 'Net/NNTP.php
  3. ?> 

array Net_NNTP::getGroups ([string $fetch = TRUE])

Description

Returns a list of all avaible newsgroups from the connected news server

Paramètres

  • $fetch - can be irgnored, unused

Valeur retournée

array - a two dimensional, nested array indicated by the name of the newsgroup, every entry contains information about the newsgroup:

  • $groups[newsgroup_name]['group'] name of the newsgroup

  • $groups[newsgroup_name]['last'] message number of the last message

  • $groups[newsgroup_name]['first'] message number of the first message

  • $groups[newsgroup_name]['posting_allowed'] values: y - yes, n - no, m - moderated)

  • $groups[newsgroup_name]['desc'] newsgroup description

Note

Cette fonction ne peut pas être appelée de façon statique.

Avertissement

Especially public news server can provide more then 30.000 newsgroup. So this function may runs longer then the maximum execution time set in the php.ini.

Exemple

Exemple 54-1. Using getGroups()

  1. <?php
  2. ...  
  3. $ret = $nntp->connect("news.php.net");  
  4. if( PEAR::isError($ret)) {  
  5. // handle error
  6. } else {  
  7. // success
  8. $groups = $nntp->getGroups();  
  9. // Print a list of avaible newsgroups
  10. foreach($groups as $group) { 
  11.    echo $group['group'].': '.$group['desc'].'<br>';  
  12. }  
  13. ?> 

Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique