You Know I did finally get this working. I wrote the following useing the fsocketopen function to connect to the server by socket and send it request info that way. Hopefully Rasmus or somebody will get around to writing a PHP function for this at some point so that the IMAP functions do all the NNTP stuff too.
$PARAMS = ( ISSET( $HTTP_POST_VARS ) ) ? $HTTP_POST_VARS : $HTTP_GET_VARS;
foreach ( $PARAMS as $key=>$value)
{
if ($key == "group")
{$News_Group = trim($value);}
if ($key == "server")
{$Server_Name = trim($value);}
if ($key == "send_message")
{$Send_Now = True;}
if ($key == "Body")
{$Message_Body = trim($value);}
if ($key == "Subject")
{$Message_Subject = trim($value);}
if ($key == "userpref")
{$User_Viewing_Preference = trim($value);}
if ($key == "repfrom")
{$Reply_From = trim($value);}
if ($key == "Reply_ID")
{
$Is_Reply = True;
$Reply_ID = trim($value);
}
if ($key == "references")
{$Message_References = trim($value);}
if ($key == "repbody")
{$Message_Old_Body = trim($value);}
}
//-------------Deterimine what path to follow in script
if (! ISSET($Send_Now))
{$Send_Now = False;}
if (! ISSET($Message_Body))
{$Message_Body = "None";}
if (! ISSET($Message_Subject))
{$Message_Subject = "None";}
if (! ISSET($User_Viewing_Preference))
{$User_Viewing_Preference = "25";}
if ( ISSET($Is_Reply) )
{
//----------strncmp: String1,String2, Int Value where Value is the first X characters to use for the string comparision. Returns 0 if equal.
if (strncmp ($Message_Subject, "Re: ", 4) != 0)
{ $Message_Subject = "Re: ".$Message_Subject; }
}
// -------------- If References Line is actually false....
if ( $Message_References == "" || strlen($Message_References) == 0)
{ unset($Message_References); }
function Stat_Line( $code , $last, $pointer, $line)
{
$status = explode( " ", $last);
if ( $status[0] != $code)
{
fputs( $pointer, "close\n");
die("<BR>Error on line".$line.": $last\n\n");
}
}
function format_mail($text, $wrapmargin)
{
$rettext = "";
$linebuf = "";
$linelen = 0;
// split the text into lines
$lines = split("[\n]", $text);
$numlines = count($lines);
for ($j = 0; $j < $numlines; $j++)
{
// split the lines into words
$tok = split("[ \t]", $lines[$j]);
$numtok = count($tok);
for ($i = 0; $i < $numtok; $i++)
{
$elem = $tok[$i];
$elemlength = strlen($elem) + 1;
if ($linelen + $elemlength > $wrapmargin)
{
// the next word should wrap so add current line to the return
$rettext = ">" . $rettext . $linebuf . "\n";
// reset buffer
$linebuf = "";
$linelen = 0;
}
// add the next word to the current (or new) line buffer
$linebuf = $linebuf . " " . $elem;
$linelen = $linelen + $elemlength;
}
// end of the line - add it to the return
$rettext = $rettext . ">" . $linebuf . "\n";
// reset buffer
$linebuf = "";
$linelen = 0;
}
return $rettext;
}
//-----------------------------------------------If / Else for Post vs. Compose new Message area-------------------
if ($Send_Now ==True)
{//--------------------------Begin Sending Statement----------------------------
//----------------------Connect to Server
$fp = fsockopen( "$Server_Name", 119, &$error, &$description, 10 );
if ( ! $fp )
{ die ("Couldn't connect to $server---->$error $description \n\n"); }
Stat_Line( 200, fgets($fp, 1024), $fp, LINE);
//----------------------Connect to Group
fputs( $fp, "group $News_Group \n" );
Stat_Line(211, fgets( $fp, 1024), $fp, LINE );
// Required Fields for sending NNTP Messages:..................
mt_srand ((double) microtime() * 10000000 );
$uid = mt_rand(10000000,99999999);
$pattern = ":$";
$replace = "";
$Today = date("l, j M y g:i:s") . " EST";
$path = "NewYork!Paris!Milan!Burbank";
$body = htmlspecialchars($Message_Body);
$subject = trim(ereg_replace($pattern, $replace, $Message_Subject));
$from = ereg_replace($pattern, $replace, $User_Name);
$organization = $User_Org;
if ( ISSET($Message_References))
{
if (strcasecmp($Message_References, $Reply_ID) != 0 )
{ $Message_References = $Message_References . " " . $Reply_ID; }
}
else
{ $Message_References = $Reply_ID; }
if (! $Is_Reply)
{
$Message_Head = "Subject: $subject\nFrom: $from\nPath: $path\nNewsgroups: $News_Group\nOrganization: $organization\nMessage-ID: <$uid@isun.net>\nDate: $Today\n\n";
}
else
{
$Message_Head = "Subject: $subject\nFrom: $from\nReferences: $Message_References\nPath: $path\nNewsgroups: $News_Group\nOrganization: $organization\nMessage-ID: <$uid@isun.net>\nDate: $Today\n\n";
}
$Message_Body = "$body\n\n.";
$Message_Package = $Message_Head.$Message_Body;
// print "<BR>--FromLine--->" . $from . "<BR>";
// print "<BR>--subjcectLine--->" . $subject . "<BR>";
// print $Message_Package."<BR>";
fputs ($fp, "post\n");
Stat_Line(340, fgets( $fp, 1024), $fp, __LINE__ );
fputs ($fp, "$Message_Package\n");
Stat_Line(240, fgets( $fp, 1024), $fp, __LINE__ );
fputs ($fp, "close\n");
$Header_String = "Location: " . $Bounce. "?group=" . $News_Group . "&userpref=" . $User_Viewing_Preference . "&server=" . "$Server_Name";
header( $Header_String );
} //-------------------------------------------------End Post Message Section