Forum Bot

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GFED
    Confirmed User
    • May 2002
    • 8121

    #1

    Forum Bot

    Hey bros, I really would like to make a forum bot like this one http://www.vereor.com/forum/viewforum.php?f=11 where I can teach it to answer repetitive questions that get asked all the time as well as have a conversation with people.

    I figured I would start with something simple... like a bot that posts the daily world news, or sports scores... something like that...

    Is this possible with Perl or would I have to use this AIML one http://alice.sunlitsurf.com to interact with my site and do what I need?

    Also, do you have any idea how to get started?

    Well, since my first bot won't be interactive (until I get a brain for it) it doesn't have to monitor the forums for new messages... just post to them at a timed interval.

    So I guess it's a simple matter of calling an HTML page (or PHP in the case with my forums) and getting the bot to fill out forms. Sounds pretty simple to me, but I don't know where to start...
    https://www.flow.page/savethechildren
  • GFED
    Confirmed User
    • May 2002
    • 8121

    #2
    I'm just learning Perl. To be more clear and concise --

    Is there is a special module I have to install to be able to talk to my website and fill forms?

    What command do I need to fetch a page?

    ?Would it be like:
    my $form = get("http://www.mydomain.com/forums/index.php?act=Post&CODE=00&f=1");

    What command do I need to fill out and send a form?

    Do I even need to get the page or can I just have it fill out the form and send it?
    https://www.flow.page/savethechildren

    Comment

    • WiredGuy
      Pounding Googlebot
      • Aug 2002
      • 34513

      #3
      LWP module. Beautiful module that let's you interact with the web (forms included).

      Once installed, perldoc LWP for details.

      If this is your first time using LWP, do something even simpler like just fetching a webpage (2 liner), and then work up from there.

      WG
      I play with Google.

      Comment

      • boldy
        Macdaddy coder
        • Feb 2002
        • 2806

        #4
        use HTML::FillInForm




        see www.cpan.org for details, it rox for form filling ... Hmmm wonder where i use that for
        MacDaddy Coder.

        Comment

        • GFED
          Confirmed User
          • May 2002
          • 8121

          #5
          Thank you sooo much buddies! Programming is sooo FUN!

          https://www.flow.page/savethechildren

          Comment

          • WiredGuy
            Pounding Googlebot
            • Aug 2002
            • 34513

            #6
            Originally posted by boldy
            use HTML::FillInForm




            see www.cpan.org for details, it rox for form filling ... Hmmm wonder where i use that for
            If you just need to fill out forms automatically, then boldy is right, use that module. LWP is more general for anything relating to web communications. More powerful but naturally more complex to code...

            WG
            I play with Google.

            Comment

            • boldy
              Macdaddy coder
              • Feb 2002
              • 2806

              #7
              Originally posted by GFED
              Thank you sooo much buddies! Programming is sooo FUN!

              MacDaddy Coder.

              Comment

              • WiredGuy
                Pounding Googlebot
                • Aug 2002
                • 34513

                #8
                Originally posted by GFED
                Thank you sooo much buddies! Programming is sooo FUN!

                We'll see :-)
                Perl is a love/hate relationship. When it doesn't work, your baffled, when it does, its sweet.

                Enjoy.
                WG
                I play with Google.

                Comment

                • GFED
                  Confirmed User
                  • May 2002
                  • 8121

                  #9
                  this is what I have so far...

                  Code:
                  #!/usr/local/bin/perl
                  
                  use LWP::Simple;
                  use HTML::FillInForm;
                  use CGI;
                  
                  print "start\n\n";
                  
                  worldnews();
                  print $reply;
                  
                  forumPost($reply);
                  
                  print "end\n\n";
                  
                  sub forumPost($reply){
                  	##form fields: TopicTitle,TopicDesc,Post
                  	print "start forumPost\n\n";
                  	my $html = get("http://www.mastersofporn.com/forums/index.php?s=&act=Post&CODE=00&f=13");
                  	#print $html;
                  	
                  	my $a = new CGI;
                  	my $b = new CGI;
                  	my $q = new CGI;
                  	
                  	$a->param("TopicTitle","testing");
                  	$b->param("TopicDesc","testing");
                  	$q->param("Post","$reply");
                  	
                  	my $fif = new HTML::FillInForm;
                  	my $output = $fif->fill(scalarref => \$html,
                  		#fobject => $q);
                  		fobject => [$a, $b, $q]);
                  		
                  	print $output;
                  	print "end forumPost\n\n";
                  }
                  
                  sub worldnews {
                  	print "start worldnews\n\n";
                  	my $content = get("http://www.maximumedge.com/cgi/news/top.txt");
                  	my @lines = split("\n",$content);
                  	foreach $line(@lines) {
                  		my @parts = split(/\|/,$line);
                  		$reply .= "A HREF=\"http://www.maximumedge.com/cgi/news/article.cgi/";
                  		$reply .= $parts[0]."\">".$parts[1]."\/A>\n\n";
                  	}
                  	return $reply;
                  	print "end worldnews\n\n";
                  }
                  I couldn't disable HTML so I took off the "<"'s on the A tags...

                  I think it's filling out the form... I can't really tell from my DOS prompt on my local machine and it gives me 500 on the server...

                  Help Please?
                  https://www.flow.page/savethechildren

                  Comment

                  • SpaceAce
                    Confirmed User
                    • Jul 2002
                    • 6493

                    #10
                    If you're going to be doing anything complex over the web, you'll want to learn LWP and IO::Socket. Hang out at http://www.perlmonks.org - they're very helpful over there. And get yourself a copy of "Perl Core Language Little Black Book".

                    Good luck,
                    SpaceAce

                    Comment

                    • SpaceAce
                      Confirmed User
                      • Jul 2002
                      • 6493

                      #11
                      Oh, yeah, and check this out for a neat example of databasing/knowledge collection:
                      http://www.smalltime.com/dictator.html

                      SpaceAce

                      Comment

                      • GFED
                        Confirmed User
                        • May 2002
                        • 8121

                        #12
                        Thanks for the links SpaceAce!
                        https://www.flow.page/savethechildren

                        Comment

                        Working...