My problems with Net_NNTP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sff11i@gmail.com

    My problems with Net_NNTP

    I always get error messages regarding the "from" address field even
    though it looks correct to me, e.g.
    news.php.net says "posting failed - invalid from"
    news.ntlworld.c om says "Posting Failed ("From" Header not in Internet
    Syntax.)"

    Versions:
    PHP 5.0.5
    Net_NNTP 1.1.2

    Full Code:
    <?php

    require_once 'Net/NNTP/Client.php';

    $nntp = new Net_NNTP_Client ();

    $nntp->setDebug();

    $nntp->connect('news. php.net');

    $subject = "Testpost";
    $newsgroup = "alt.binaries.t est";
    $body = "test";
    $from = "test@example.c om";

    $response = $nntp->post($subjec t, $newsgroup, $from, $body);

    var_dump($respo nse);

    ?>

  • Andy Hassall

    #2
    Re: My problems with Net_NNTP

    On 9 Oct 2005 23:38:28 -0700, sff11i@gmail.co m wrote:
    [color=blue]
    >I always get error messages regarding the "from" address field even
    >though it looks correct to me, e.g.
    >news.php.net says "posting failed - invalid from"
    >news.ntlworld. com says "Posting Failed ("From" Header not in Internet
    >Syntax.)"
    >
    >$response = $nntp->post($subjec t, $newsgroup, $from, $body);[/color]

    You've got the parameters in the wrong order.

    /**
    * Post an article to a number of newsgroups.
    *
    * (Among the aditional headers you might think of adding could be:
    * "NNTP-Posting-Host: <ip-of-author>", which should contain the IP-address
    * of the author of the post, so the message can be traced back to him.
    * Or "Organizati on: <org>" which contain the name of the organization
    * the post originates from)
    *
    * @param string $newsgroups The newsgroup to post to.
    * @param string $subject The subject of the post.
    * @param string $body The body of the post itself.
    * @param string $from Name + email-adress of sender.
    * @param optional string $aditional Aditional headers to send.
    *
    * @return mixed (string) server response on success or (object) pear_error
    on failure
    * @access public
    */
    function post($newsgroup s, $subject, $body, $from, $aditional = null)
    {
    return $this->cmdPost($newsg roups, $subject, $body, $from, $aditional);
    }

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • sff11i@gmail.com

      #3
      Re: My problems with Net_NNTP

      Andy Hassall wrote:[color=blue]
      > You've got the parameters in the wrong order.[/color]

      Thanks Andy, I had copied the faulty code from Example 46-1:


      Didn't notice it was deprecated :)

      Comment

      Working...