/** * Get Article * * @param var Id eighter a messageId or an articleId * @return peer.news.Article * @throws io.IOException in case article could not be retrieved */ public function getArticle($id = NULL) { $status = $this->_sendcmd('ARTICLE', $id); if (!NntpReply::isPositiveCompletion($status)) { throw new IOException('Could not get article'); } with($args = explode(' ', $this->getResponse())); $article = new Article($args[0], $args[1]); // retrieve headers while ($line = $this->_readData()) { if ("\t" == $line[0] || ' ' == $line[0]) { $article->setHeader($header[0], $article->getHeader($header[0]) . "\n" . $line); continue; } $header = explode(': ', $line, 2); $article->setHeader($header[0], $header[1]); } // retrieve body while (FALSE !== ($line = $this->_readData())) { $body .= $line . "\n"; } $article->setBody($body); return $article; }