README
1######################################################################
2 WWW::Mechanize::Plugin::phpBB 0.02
3######################################################################
4
5NAME
6 WWW::Mechanize::Plugin::phpBB - Screen scraper for phpBB installations
7
8SYNOPSIS
9 use WWW::Mechanize::Pluggable;
10 use Log::Log4perl qw(:easy);
11 Log::Log4perl->easy_init($DEBUG);
12
13 my $mech = new WWW::Mechanize::Pluggable;
14
15 $mech->get("http://some.forum.site.com/forum");
16 $mech->phpbb_login("username", "password");
17
18 # Get a list of forums
19 my $forums = $mech->phpbb_forums();
20 for my $forum (@$forums) {
21 print "Forum:", $forum->text(), "\n";
22 }
23
24 # Enter a forum matched by a regex
25 $mech->phpbb_forum_enter(qr(^The Forum Name$));
26
27 # Return a list of topics
28 my $topics = $mech->phpbb_topics();
29 for my $topic (@$topics) {
30 print "headline=$topic->{text} url=$topic->{url}\n";
31 }
32
33DESCRIPTION
34 "WWW::Mechanize::Plugin::phpBB" is a screen scraper for phpBB driven
35 forum sites. It can log into the phpBB web interface, pull forum and
36 topics names and perform administrative tasks like deleting posts.
37
38 FUNCTIONALITY IS CURRENTLY LIMITED, READ ON WHAT'S AVAILABLE SO FAR.
39
40 "WWW::Mechanize::Plugin::phpBB" is implemented as a plugin to
41 WWW::Mechanize, using Joe McMahon's WWW::Mechanize::Pluggable framework.
42
43 $mech->phpbb_login($user, $passwd)
44 Log into the phpBB web interface using the given credentials. It
45 requires that the $mech object currently points to a phpBB page
46 showing a "Login" link.
47
48 Note that most forums don't require you to log in in order to read
49 the messages, so this is only necessary if you want to perform
50 administrative tasks (like phpbb_post_remove()) or read a private
51 forum.
52
53 Returns "undef" if the login fails and fires a Log4perl message at
54 level ERROR.
55
56 my $forums = $mech->phpbb_forums()
57 If the $mech object points to a forum site's overview page listing
58 the forums, phpbb_forums will return a ref to an array of forums.
59 Every element of the array is a WWW::Mechanize::Link object and
60 therefore has the methods "text()" and "url" to show forum name and
61 the forum url:
62
63 # Get a list of forums
64 my $forums = $mech->phpbb_forums();
65 for my $forum (@$forums) {
66 print "Forum:", $forum->text(), " ",
67 $forum->url(), "\n";
68 }
69
70 $mech->phpbb_forum_enter($regex)
71 If the $mech object points to a forum site's overview page listing
72 the forums, "phpbb_forum_enter" will have the WWW::Mechanize object
73 enter the first forum matching the specified regex:
74
75 # Enter a forum matched by a regex
76 $mech->phpbb_forum_enter(qr(^The Forum Name$));
77
78 Returns 1 on success and undef on failure.
79
80 my $topics = $mech->phpbb_topics()
81 If the $mech object points to a forum page listing the topics,
82 "phpbb_topics" will scrape the topics off that page (which might
83 only be a fraction of the topics available for the given forum):
84
85 # Return a list of topics
86 my $topics = $mech->phpbb_topics();
87 for my $topic (@$topics) {
88 print "headline=$topic->{text} url=$topic->{url}\n";
89 }
90
91 Every element of the array ref returned is a hashref, containing
92 values for the keys "text" (topic headline), "url" (url to the first
93 page showing this topic), "count" (number of postings for this
94 topic).
95
96 $mech->phpbb_post_remove($post_id)
97 Note that you need to perform a successful login() before using this
98 method. phpbb_post_remove takes a post ID (like the '6' in
99 "forum/posting.php?mode=quote&p=6"), pulls up the page showing the
100 post, clicks the 'X' button and then clicks 'Yes' in the
101 confirmation dialog to delete the posting. Handy for automatically
102 deleting spammer postings.
103
104AUTHOR
105 Mike Schilli, m@perlmeister.com
106
107COPYRIGHT AND LICENSE
108 Copyright (C) 2006 by Mike Schilli, m@perlmeister.com
109
110 This library is free software; you can redistribute it and/or modify it
111 under the same terms as Perl itself, either Perl version 5.8.5 or, at
112 your option, any later version of Perl 5 you may have available.
113
114