GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Forum Bot (https://gfy.com/showthread.php?t=77442)

GFED 09-15-2002 11:29 PM

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

GFED 09-16-2002 12:26 AM

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?

WiredGuy 09-16-2002 12:29 AM

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

boldy 09-16-2002 12:29 AM

use HTML::FillInForm




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

GFED 09-16-2002 12:30 AM

Thank you sooo much buddies! Programming is sooo FUN! :)

:thumbsup

WiredGuy 09-16-2002 12:31 AM

Quote:

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

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

boldy 09-16-2002 12:31 AM

Quote:

Originally posted by GFED
Thank you sooo much buddies! Programming is sooo FUN! :)

:thumbsup

:eek7

WiredGuy 09-16-2002 01:10 AM

Quote:

Originally posted by GFED
Thank you sooo much buddies! Programming is sooo FUN! :)

:thumbsup

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

Enjoy.
WG

GFED 09-17-2002 12:44 AM

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?

SpaceAce 09-17-2002 12:53 AM

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

SpaceAce 09-17-2002 12:55 AM

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

SpaceAce

GFED 09-17-2002 03:43 AM

Thanks for the links SpaceAce! :)


All times are GMT -7. The time now is 10:53 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123