Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0

Bug #817 post() doesnt work (v0.2.3)
Submitted: 2004-02-20 20:20 UTC Modified: 2004-03-10 03:51 UTC
From: jake at braingle dot com Assigned: heino
Status: Closed Package: Net_NNTP
PHP Version: 4.3.4 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-02-20 20:20 UTC] jake at braingle dot com
Description: ------------ The post method does not work in the stable version (0.2.3). To fix it, you need to make the make the lines terminate with \r and \n like so: fputs($this->fp, "Newsgroups: $newsgroup\r\n"); fputs($this->fp, "Subject: $subject\r\n"); ... Also, this function will not work with news servers that require authentication. To fix that, I added this line to the top of the post function: $error = $this->authenticate($this->user, $this->pass, $this->authmode); now it works. :) Reproduce code: --------------- $response = $nntp->post($subject, $group, $from, $body); Expected result: ---------------- the message would be posted Actual result: -------------- the message is not posted

Comments

 [2004-02-21 18:08 UTC] heino at php dot net
How about replacing line 261-276 with something like (not tested, since I'm rather busy): --------------------------------------------------------- $r = $this->command('POST'); if (PEAR::isError($r) || $this->responseCode($r) != 340) { return $this->raiseError($r); } $data = ''; $data .= "From: $from\r\n"; $data .= "Newsgroups: $newsgroup\r\n"; $data .= "Subject: $subject\r\n"; $data .= "X-poster: PEAR::Net_NNTP (0.2) by Martin Kaltoft\r\n"; if (!empty($aditional)) { $data .= rtrim($aditional, "\r\n")."\r\n"; } $data .= "\r\n"; $data .= "$body\r\n"; $data .= "."; return $this->command($data, false); ---------------------------------------------------------
 [2004-02-21 19:09 UTC] jake at braingle dot com
Yes, I believe that would fix it.
 [2007-10-19 20:37 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!