Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting list of newsgroups via php

0 views
Skip to first unread message

Travis McCarter

unread,
Sep 13, 2003, 11:07:05 PM9/13/03
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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-----


sam

unread,
Sep 14, 2003, 5:16:09 AM9/14/03
to

To get the list of all newsgroups use the LIST command:

----------- 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 McCarter

unread,
Sep 14, 2003, 1:08:48 PM9/14/03
to
But how do you do it programatically? Can I read each group into a string?

Travis


"sam" <rba...@caramail.com> wrote in message
news:bk1bdl$1lid$1...@news.cybercity.dk...

sam

unread,
Sep 15, 2003, 5:27:20 AM9/15/03
to
$nntp_server = "news.nntpserver.com"; // set your server here
$nntp_port = 119; // do not change this unless you know what you do.
$time_out = 30; // timeout in seconds

$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...

Moreno Tiziani

unread,
Sep 15, 2003, 6:34:04 AM9/15/03
to
"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

Nexus

unread,
Sep 15, 2003, 6:35:52 AM9/15/03
to
"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 :) :

0 new messages