tags:

views:

379

answers:

2

I'd like to access NNTP servers, groups, and messages through PHP. Is there any existing class you'd recommend? Preferably PHP5 and good OOP.

+1  A: 

It's not a class, but must php installs have the php-imap extension compiled in and you can do all you want with straight php calls.

You can see documentation starts here: http://us.php.net/manual/en/book.imap.php

Examples of opening a connection to an NNTP server can be found in the imap_open topic.

Like this:

  // To connect to an group on an NNTP server on port 119 on the local server, use:
  $nntp = imap_open ("{localhost:119/nntp}comp.test", "", "");

OR

  // To connect to a nonlocal server without specifying a group:
  $server = "{news.servername.com/nntp:119}";
  $nntp = imap_open($server,"","",OP_HALFOPEN);

Then you can just request the info that you want:

  $headers = imap_headers($nntp);     
  $threads = imap_thread($nntp);

That's not exactly what you'd asked for, but I hope it helps.

+1  A: 

Also not a class, and also not OOP, and also not PHP 5 specific, the code behind http://news.php.net is available here:

php-news sources

Wez Furlong