Andy,

I've recently written an newsgroup (NNTP) gateway between FUDforum and 
newsgroup, which allows read/write data sharing between the two. The solution 
for tracking down the reply to is done via 2 headers X-Reply-To or 
In-Reply-To or most commonly References headers. There are a number of mail 
clients that break the convention and send no such data, in which case you 
need to do match replies based on subject. The latter occurs only very rarely 
and in most cases you have a header with a unique ID against which you can 
match messages.

-- 
Ilia Alshanetsky
[EMAIL PROTECTED]
http://fud.prohost.org/forum/

On August 8, 2002 04:10 pm, andy wrote:
> Hi guys,
>
> I am trying to build a usenet gateway which is collecting usenet posts and
> puts them into a phpbb forum. Same other way around. So I did read an
> excelent article on that published by Armel Fauveau at:
> http://www.phpbuilder.com/columns/armel20010427.php3?page=1 (this is where
> the code underneath is from. So getting the articles works.
>
> My problem is how to glue all the articles together which are relies. I am
> sure there is a way to find out which reply belongs to a post. I would like
> to feed the phpbb database with it.
>
> This is an example of an article including the header:
>
> Newsgroups: php.general Path: news.php.net Xref: news.php.net
> php.general:111709 Return-Path: Mailing-List: contact
> [EMAIL PROTECTED]; run by ezmlm Delivered-To: mailing list
> [EMAIL PROTECTED] Received: (qmail 81897 invoked by uid 1007); 8
> Aug 2002 18:28:33 -0000 Message-ID:
> <[EMAIL PROTECTED]> To: [EMAIL PROTECTED]
> Reply-To: "sebastian" Date: Thu, 8 Aug 2002 20:27:21 +0200 Lines: 11
> X-Priority: 3 X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced
> By Microsoft MimeOLE V6.00.2600.0000 X-Posted-By: 141.44.162.176 Subject:
> streaming mp3-audio??? From: [EMAIL PROTECTED] (Sebastian) hi @ all!
> im looking for an algorithm or class to stream mp3-audiofiles, such as
> easy as it can be. i found nothing on php.net and downloaded some
> phpscripts from hotscripts and sourceforge but they were all very cryptical
> and bad documentated. please help me, many thanks sebastian .
>
>
> Lots of text.. puhh! I hope this is somehow possible. Maybe one of you guys
> has a good idea on that. You can just cut and past the code underneath and
> try it out by yourself.
>
> Thanx for any help on that.
>
> Andy
>
> -----------------------------
> http://www.OZforum.info
> Australia Information Forum
>
>
>
>
> <?php
> # http://www.phpbuilder.com/columns/armel20010427.php3?page=3
>
> $cfgServer    = "news.php.net";
> $cfgPort    = 119;
> $cfgTimeOut    = 10;
>
> // open a socket
> if(!$cfgTimeOut)
>     // without timeout
>     $usenet_handle = fsockopen($cfgServer, $cfgPort);
> else
>     // with timeout
>     $usenet_handle = fsockopen($cfgServer, $cfgPort, $errno, $errstr,
> $cfgTimeOut);
>
> if(!$usenet_handle) {
>     echo "Connexion failed\n";
>     exit();
> }
> else {
>     echo "Connected\n";
>     $tmp = fgets($usenet_handle, 1024);
> }
>
> ###################
> # page 2
>
> //$cfgUser    = "xxxxxx";
> //$cfgPasswd    = "yyyyyy";
> $cfgNewsGroup    = "php.general";
>
> // identification required on private server
> if($cfgUser) {
>     fputs($usenet_handle, "AUTHINFO USER ".$cfgUser."\n");
>     $tmp = fgets($usenet_handle, 1024);
>
>     fputs($usenet_handle, "AUTHINFO PASS ".$cfgPasswd."\n");
>     $tmp = fgets($usenet_handle, 1024);
>
>     // check error
>
>     if($tmp != "281 Ok\r\n") {
>         echo "502 Authentication error\n";
>         exit();
>     }
> }
>
> // select newsgroup
>
> fputs($usenet_handle, "GROUP ".$cfgNewsGroup."\n");
> $tmp = fgets($usenet_handle, 1024);
>
> if($tmp == "480 Authentication required for command\r\n") {
>     echo "$tmp\n";
>     exit();
> }
>
> $info = split(" ", $tmp);
> $first = $info[2];
> $last = $info[3];
>
> print "First : $first\n<br>";
> print "Last : $last\n<br>";
>
> ###################
> # page 3
>
> $cfgLimit    = 10;
>
> // upload last articles
>
> $boucle=$last-$cfgLimit;
>
> while ($boucle <= $last) {
>
>     set_time_limit(0);
>
>     fputs($usenet_handle, "ARTICLE $boucle\n");
> #    fputs($usenet_handle, "BODY $boucle\n");
>
>     $article="";
>     $tmp = fgets($usenet_handle, 4096);
>
>     if(substr($tmp,0,3) != "220" AND substr($tmp,0,3) != "222") {
>         echo "+----------------------+\n<br>";
>         echo "Error on article $boucle\n<br>";
>         echo "+----------------------+\n<br>";
>     }
>     else {
>         while($tmp!=".\r\n") {
>             $tmp = fgets($usenet_handle, 4096);
>
>    $article = $article.$tmp;
>         }
>
>         echo "+----------------------+\n<br>";
>         echo "Article $boucle\n<br>";
>         echo "+----------------------+\n<br>";
>         echo "$article\n<br>";
>     }
>
>     $boucle++;
>
>
> }
>
> // close connexion
>
> fclose($usenet_handle);
>
> ?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to