473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Getting list of newsgroups via php

-----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+aLWem6X6SuDE aVypwAoN17
VUlkCyCO1trp6sajVqAG/DrZ
=+jvW
-----END PGP SIGNATURE-----
Jul 16 '05 #1
5 2645
sam

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" <tr*****@sunrisenetwork.net> wrote in message
news:3f********@athenanews.com...
-----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+aLWem6X6SuDE aVypwAoN17
VUlkCyCO1trp6sajVqAG/DrZ
=+jvW
-----END PGP SIGNATURE-----

Jul 16 '05 #2
But how do you do it programatically? Can I read each group into a string?

Travis
"sam" <rb*****@caramail.com> wrote in message
news:bk***********@news.cybercity.dk...

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" <tr*****@sunrisenetwork.net> wrote in message
news:3f********@athenanews.com...
-----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+aLWem6X6SuDE aVypwAoN17
VUlkCyCO1trp6sajVqAG/DrZ
=+jvW
-----END PGP SIGNATURE-----


Jul 16 '05 #3
sam
$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" <tr*****@sunrisenetwork.net> wrote in message
news:3f**********@athenanews.com...
But how do you do it programatically? Can I read each group into a string?
Travis
"sam" <rb*****@caramail.com> wrote in message
news:bk***********@news.cybercity.dk...

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" <tr*****@sunrisenetwork.net> wrote in message
news:3f********@athenanews.com...
-----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+aLWem6X6SuDE aVypwAoN17
VUlkCyCO1trp6sajVqAG/DrZ
=+jvW
-----END PGP SIGNATURE-----



Jul 16 '05 #4
"Travis McCarter" <tr*****@sunrisenetwork.net> wrote in message
news:3f**********@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
Jul 16 '05 #5
"Travis McCarter" <tr*****@sunrisenetwork.net> wrote in message
news:3f**********@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
Jul 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: la_haine | last post by:
Hello, Does anybody know of a quick and dirty way that I can connect to a news server, retrieve a list of all newsgroups beginning with alt. (or comp., or blah., or wibble., doesn't really...
1
by: Rene Aube | last post by:
Hi everyone, I'm incharge of updating the stats on a chl hockey teams Web Site. I would like to know if there is a way to be able to save the content of the CHL Statistics WebPage on our Server...
8
by: Guy Hocking | last post by:
Hi there, I am having a few problems compiling a list box that is conditional on what is selected in another list box. What i need is a List box (lstArea) that displays one thing when the List...
13
by: Mike Tyndall | last post by:
Sorry I'm late, everybody! I'll try to post it nearer the start of the month next time. Updates: -Books added: C++ Coding Standards (Required Reading - upcoming) Memory as a Programming...
19
by: RAJASEKHAR KONDABALA | last post by:
Hi, Does anybody know what the fastest way is to "search for a value in a singly-linked list from its tail" as oposed to its head? I am talking about a non-circular singly-linked list, i.e.,...
3
by: Vittal | last post by:
Hello, Is it possible to write a C program to find out what all the dynamic and static libraries any executable is using. I mean program should do what 'ldd' does on Unix and it should help me...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
8
by: bryan | last post by:
Is there any way I can get the application path (the one returned by Request.ApplicationPath) in the Application_Start method in Global.asax? Request is not valid there. On a related note, is there...
3
by: Thomas Morton | last post by:
This is a "thing" that has been annoying me all morning: and I can't work out how to do it. I need a way to get the DPI or screen resolution of the monitor that a script is currently runnign on....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.