PEAR Manual
This manual is provided as a courtesy. It is not an official source. Please check pear.php.net for updated information.
require_once 'Net/NNTP.php';
array Net_NNTP::getGroups ([string $fetch = TRUE])
array Net_NNTP::getGroups
Returns a list of all avaible newsgroups from the connected news server
$fetch - can be irgnored, unused
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
This function can not be called statically.
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.
Net_NNTP::selectGroup()
Example 47-1. Using getGroups()
... $ret = $nntp->connect("news.php.net"); if( PEAR::isError($ret)) { // handle error } else { // success $groups = $nntp->getGroups(); // Print a list of avaible newsgroups foreach($groups as $group) { echo $group['group'].': '.$group['desc'].'<br>'; } }