I am trying to write a PHP script that will download a list of all
the newsgroups on a news server and put them into a MySQL database.
I bought a $50 book that had some NNTP examples in it, but none of
them show how to just download the groups, not the articles. I tried
on my own for about 2 hours with no luck. If someone can point me in
the right direction to download the group list using PHP, I think I
can figure out how to write it to a database.
Thanks,
Travis
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.8
iQA/AwUBP2PbWIHFTs7ILPgZEQLAjwCfd3nWCRXbo+aLWem6X6SuDEaVypwAoN17
VUlkCyCO1trp6sajVqAG/DrZ
=+jvW
-----END PGP SIGNATURE-----
----------- FROM RFC977 (NNTP PROTOCOL)-----------
LIST
Returns a list of valid newsgroups and associated information. Each
newsgroup is sent as a line of text in the following format:
group last first p
where <group> is the name of the newsgroup, <last> is the number of
the last known article currently in that newsgroup, <first> is the
number of the first article currently in the newsgroup, and <p> is
either 'y' or 'n' indicating whether posting to this newsgroup is
allowed ('y') or prohibited ('n').
-------------------- END ------------------------
For more infos about the NNTP protocol:
http://www.faqs.org/rfcs/rfc977
HTH
"Travis McCarter" <tra...@sunrisenetwork.net> wrote in message
news:3f63d...@athenanews.com...
Travis
"sam" <rba...@caramail.com> wrote in message
news:bk1bdl$1lid$1...@news.cybercity.dk...
$fp = fsockopen($nntp_server, $nntp_port, $errno, $errstr, $time_out);
if (!$fp) {
echo "$errstr ($errno)";
} else {
fputs($fp, "LIST\r\n");
while (!feof($fp)) {
// read one line from the socket
$buffer = fgets($fp,256);
// $buffer will contain something like
// this "alt.comp.lang.php 00000515 00000926 y"
/*
do what you want to do with the buffer here
*/
}
fclose ($fp);
}
"Travis McCarter" <tra...@sunrisenetwork.net> wrote in message
news:3f64a134$1...@athenanews.com...
> But how do you do it programatically? Can I read each group into a string?
Have a look to mynewsgroups :) :
http://mynewsgroups.sourceforge.net/
Hope this help you!
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
> But how do you do it programatically? Can I read each group into a string?
Have a look to mynewsgroups :) :