• User

    Usenet y PHP

    Vi è mai capitato di dover mandare un messaggio ad usenet da PHP?
    Ho smanettato in giro ed ho trovato alcuni script, ma inviano il messaggio ad un indirizzo che fa da gateway e lo inoltra automaticamente al server, quindi nisba.

    Ho trovato anche questo:
    http://pear.php.net/package/Net_NNTP

    ma non mi è per niente chiaro.

    Ho provato a fare questo script, ma ovviamente non funziona.

    Qualcuno mi sa dire se è molto distante da quello di cui ho bisogno?

    <?

    $server="news.edisontel.com";
    $newsgroup="it.test";
    $port=119;

    $stream = fsockopen($server,$port, &$errno, &$errstr);
    fwrite($stream, "POST\r\n");
    fwrite($stream, "From: <[email protected]\n");
    fwrite($stream, "Newsgoups ".$newsgroup."\n");
    fwrite($stream, "Subject: Prova\n");
    // fwrite($stream, "Date: ".now()."\n"); <-- questa la dovrebbe mettere il server, idem per il Message-ID.
    fwrite($stream, "Organization: Dean\n\n");
    fwrite ($stream, "Prova\n");
    fclose($stream);

    ?>

    Questa è l'intestazione di un messaggio preso da un newsgroup...

    Path: reader1.news.tin.it!spool.news.tin.it!feeder.news.tin.it!news.ngi.it!nnrp.ngi.it!not-for-mail
    From: mittente [email protected]
    Newsgroups: it.test
    Subject: prova
    Date: Mon, 27 Feb 2006 16:16:36 +0100
    Organization: Diluvi Universali INC.
    Lines: 1
    Message-ID: < dovrebbe darlo il server automaticamente >
    NNTP-Posting-Host: 194-185-53-52.f5.ngi.it
    Mime-Version: 1.0
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: 8bit
    X-Trace: nnrp.ngi.it 1141053357 8058 194.185.53.52 (27 Feb 2006 15:15:57 GMT)
    X-Complaints-To: [email][email protected][/email]
    NNTP-Posting-Date: Mon, 27 Feb 2006 15:15:57 +0000 (UTC)
    User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
    Xref: reader1.news.tin.it it.test:5784889