Getting list of newsgroups via php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Travis McCarter

    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/AwUBP2PbWIHFTs7 ILPgZEQLAjwCfd3 nWCRXbo+aLWem6X 6SuDEaVypwAoN17
    VUlkCyCO1trp6sa jVqAG/DrZ
    =+jvW
    -----END PGP SIGNATURE-----


  • sam

    #2
    Re: Getting list of newsgroups via php


    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:



    HTH

    "Travis McCarter" <travism@sunris enetwork.net> wrote in message
    news:3f63dbee_2 @athenanews.com ...[color=blue]
    > -----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/AwUBP2PbWIHFTs7 ILPgZEQLAjwCfd3 nWCRXbo+aLWem6X 6SuDEaVypwAoN17
    > VUlkCyCO1trp6sa jVqAG/DrZ
    > =+jvW
    > -----END PGP SIGNATURE-----
    >
    >[/color]


    Comment

    • Travis McCarter

      #3
      Re: Getting list of newsgroups via php

      But how do you do it programatically ? Can I read each group into a string?

      Travis


      "sam" <rbaba99@carama il.com> wrote in message
      news:bk1bdl$1li d$1@news.cyberc ity.dk...[color=blue]
      >
      > 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" <travism@sunris enetwork.net> wrote in message
      > news:3f63dbee_2 @athenanews.com ...[color=green]
      > > -----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/AwUBP2PbWIHFTs7 ILPgZEQLAjwCfd3 nWCRXbo+aLWem6X 6SuDEaVypwAoN17
      > > VUlkCyCO1trp6sa jVqAG/DrZ
      > > =+jvW
      > > -----END PGP SIGNATURE-----
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • sam

        #4
        Re: Getting list of newsgroups via php

        $nntp_server = "news.nntpserve r.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" <travism@sunris enetwork.net> wrote in message
        news:3f64a134$1 _6@athenanews.c om...[color=blue]
        > But how do you do it programatically ? Can I read each group into a[/color]
        string?[color=blue]
        >
        > Travis
        >
        >
        > "sam" <rbaba99@carama il.com> wrote in message
        > news:bk1bdl$1li d$1@news.cyberc ity.dk...[color=green]
        > >
        > > 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" <travism@sunris enetwork.net> wrote in message
        > > news:3f63dbee_2 @athenanews.com ...[color=darkred]
        > > > -----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/AwUBP2PbWIHFTs7 ILPgZEQLAjwCfd3 nWCRXbo+aLWem6X 6SuDEaVypwAoN17
        > > > VUlkCyCO1trp6sa jVqAG/DrZ
        > > > =+jvW
        > > > -----END PGP SIGNATURE-----
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Moreno Tiziani

          #5
          Re: Getting list of newsgroups via php

          "Travis McCarter" <travism@sunris enetwork.net> wrote in message
          news:3f64a134$1 _6@athenanews.c om
          [color=blue]
          > But how do you do it programatically ? Can I read each group into a string?[/color]

          Have a look to mynewsgroups :) :


          Hope this help you!


          --
          Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

          Comment

          • Nexus

            #6
            Re: Getting list of newsgroups via php

            "Travis McCarter" <travism@sunris enetwork.net> wrote in message
            news:3f64a134$1 _6@athenanews.c om
            [color=blue]
            > But how do you do it programatically ? Can I read each group into a string?[/color]

            Have a look to mynewsgroups :) :


            Hope this help you!




            --
            Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

            Comment

            Working...