Hello Everyone:
I have a question regarding a script that I am trying to write. This script is
supposed to read from a text file containing various newsgroups and post a
message to each newsgroup automatically.
Here is the part of the script that does the posting:
<?php
$nntp = fsockopen( 'news.cox-internet.com', '119', $errno, $errstr, 10 )
or die( 'An Error Occurred' );
echo 'Sending POST: ' . fwrite( $nntp, "POST\n" ) . "\n";
echo 'Sending FROM: ' . fwrite( $nntp, "FROM: [EMAIL PROTECTED]" ) .
"\n";
echo 'Sending SUBJECT: ' . fwrite( $nntp, "SUBJECT: Testing\n" ) .
"\n";
echo 'Sending NEWSGROUPS: ' . fwrite( $nntp, "NEWSGROUPS: alt.test\n\n"
) . "\n";
echo 'Sending Body: ' . fwrite( $nntp, "Testing Testing\n\n" ) . "\n";
echo 'Closing Connection ... ' . fwrite( $nntp, ".\n" ) . "\n";
fclose($nntp);
echo 'Errors from server: ' . $errno . ' ' . $errstr . "\n";
?>
After running the script I do not get errors from the fwrite function which I
assume is writing to the stream. However, the postings never make it to the
newsgroup. I have tested the script manually by telneting to the news server
and input the data manually. No problems there.
My question is: is it possible for the NNTP server to block automated scripts?
can the NNTP server tell the diference between a telnet session and the
script? or is there something wrong with the script I have written that I
might have overlooked. I have also tried inserting sleep( 1 ); in various
places and even after every statement just in case that the server response
was to slow.
Thanks, any help would be appreciated.
Alvaro Zuniga