0

In the code below I can get a list of "message-id"s in a group I selected earlier. Now with that info I can retreive the header with

head "message-ID"

how do I find out what the size of the article is? Like what php imap does with imap_fetch_overview(); It goes without saying that I do not want to download the whole body. Just want the file size.

fputs($usenet_handle, "newnews ".$cfgNewsGroup." 111126 000000\n");
        while ($buffer != ".\r\n") {
            $buffer = fgets($usenet_handle, 1024);
            if ($buffer != ".\r\n") {
                echo $buffer;
            }
        }
renevdkooi
  • 1,515
  • 1
  • 17
  • 42

1 Answers1

0

NNTP servers generally don't store the article size in the headers. That makes it impossible to know what size it is by just looking at the header.

However, as you're talking about file sizes, I guess you're doing something with NZB files. If you'd like to know the size of an NZB collection, just download the NZB and calculate it from there.

Friek
  • 1,533
  • 11
  • 13
  • how come the php imap function can get the message size? Isn't it based on the same way of talking to the server? – renevdkooi Nov 27 '11 at 12:32
  • No, NNTP servers are a lot different from IMAP servers. In the traditional Usenet system, the message size wasn't really that important, so I guess that's why popular NNTP servers didn't implement it. – Friek Nov 27 '11 at 13:47
  • using php imap function I am able to connect to a newsgroup and get the header which tells me the size of the message. The problem I have though is that I am able to connect to most newsgroup groups but for example alt.binaries.boneless will not connect. While alt.binaries.fonts for example does work (and most smaller a.b.* groups), while when using fsockopen i am able to communicate and do everything with that group , just not find out the article size. – renevdkooi Nov 28 '11 at 02:37
  • My guess is that the php imap function executes a body command to determine the size, except for when a group exceeds a configured amount of messages. You'd have to dig in the imap functionality to verify this.. – Friek Nov 28 '11 at 13:48