Why can't I connect to an NNTP server?

290 views Asked by At

I'm trying to use PHP's imap_open function to connect to an NNTP server but have so far been entirely unsuccessful. (PHP documentation states that this is possible, despite IMAP access being the primary purpose of the function.) After trying fruitlessly to troubleshoot a few free newsreaders for PHP, I've boiled the code down to its very simplest element:

<?php
$nntp = imap_open("{news.mozilla.org:119/nntp}", "", "");
?>

However, you can see what happens when I try to run that on two completely different servers, configured by different organizations:

http://tiszenkel.com/channelone/nntn/nntp.php

http://video.channelone.com/newsreader/nntp.php

Is there some server setting I'm missing in both cases? (I'm not the administrator for either server, but I can make requests of the admin for one of them.)

2

There are 2 answers

1
Rob J On

It looks as if you may need OP_ANONYMOUS as the fourth parameter of imap_open.

See the info & examples in this link:

PHP Cookbook entry on imap_open

0
Wrikken On
$ref = '{news.mozilla.org:119/nntp}';
$imap = imap_open($ref,"","",OP_HALFOPEN);
var_dump(imap_list($imap,$ref,'*announce*'));

array(4) {
  [0]=>
  string(57) "{news.mozilla.org:119/nntp}mozilla.announce.compatibility"
  [1]=>
  string(59) "{news.mozilla.org:119/nntp}netscape.public.mozilla.announce"
  [2]=>
  string(43) "{news.mozilla.org:119/nntp}mozilla.announce"
  [3]=>
  string(52) "{news.mozilla.org:119/nntp}mozilla.dev.l10n.announce"
}