GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
WWW::Mechanize::Plugin::phpBB(3) User Contributed Perl Documentation WWW::Mechanize::Plugin::phpBB(3)

WWW::Mechanize::Plugin::phpBB - Screen scraper for phpBB installations

    use WWW::Mechanize::Pluggable;
    use Log::Log4perl qw(:easy);
    Log::Log4perl->easy_init($DEBUG);

    my $mech = new WWW::Mechanize::Pluggable;

    $mech->get("http://some.forum.site.com/forum");
    $mech->phpbb_login("username", "password");

        # Get a list of forums
    my $forums = $mech->phpbb_forums();
    for my $forum (@$forums) {
        print "Forum:", $forum->text(), "\n";
    }

        # Enter a forum matched by a regex
    $mech->phpbb_forum_enter(qr(^The Forum Name$));

        # Return a list of topics
    my $topics = $mech->phpbb_topics();
    for my $topic (@$topics) {
        print "headline=$topic->{text} url=$topic->{url}\n";
    }

"WWW::Mechanize::Plugin::phpBB" is a screen scraper for phpBB driven forum sites. It can log into the phpBB web interface, pull forum and topics names and perform administrative tasks like deleting posts.

FUNCTIONALITY IS CURRENTLY LIMITED, READ ON WHAT'S AVAILABLE SO FAR.

"WWW::Mechanize::Plugin::phpBB" is implemented as a plugin to WWW::Mechanize, using Joe McMahon's WWW::Mechanize::Pluggable framework.

$mech->phpbb_login($user, $passwd)
Log into the phpBB web interface using the given credentials. It requires that the $mech object currently points to a phpBB page showing a "Login" link.

Note that most forums don't require you to log in in order to read the messages, so this is only necessary if you want to perform administrative tasks (like phpbb_post_remove()) or read a private forum.

Returns "undef" if the login fails and fires a Log4perl message at level ERROR.

my $forums = $mech->phpbb_forums()
If the $mech object points to a forum site's overview page listing the forums, phpbb_forums will return a ref to an array of forums. Every element of the array is a WWW::Mechanize::Link object and therefore has the methods "text()" and "url" to show forum name and the forum url:

        # Get a list of forums
    my $forums = $mech->phpbb_forums();
    for my $forum (@$forums) {
        print "Forum:", $forum->text(), " ", 
              $forum->url(), "\n";
    }
    
$mech->phpbb_forum_enter($regex)
If the $mech object points to a forum site's overview page listing the forums, "phpbb_forum_enter" will have the WWW::Mechanize object enter the first forum matching the specified regex:

        # Enter a forum matched by a regex
    $mech->phpbb_forum_enter(qr(^The Forum Name$));
    

Returns 1 on success and undef on failure.

my $topics = $mech->phpbb_topics()
If the $mech object points to a forum page listing the topics, "phpbb_topics" will scrape the topics off that page (which might only be a fraction of the topics available for the given forum):

        # Return a list of topics
    my $topics = $mech->phpbb_topics();
    for my $topic (@$topics) {
        print "headline=$topic->{text} url=$topic->{url}\n";
    }
    

Every element of the array ref returned is a hashref, containing values for the keys "text" (topic headline), "url" (url to the first page showing this topic), "count" (number of postings for this topic).

$mech->phpbb_post_remove($post_id)
Note that you need to perform a successful login() before using this method. phpbb_post_remove takes a post ID (like the '6' in "forum/posting.php?mode=quote&p=6"), pulls up the page showing the post, clicks the 'X' button and then clicks 'Yes' in the confirmation dialog to delete the posting. Handy for automatically deleting spammer postings.

Mike Schilli, m@perlmeister.com

Copyright (C) 2006 by Mike Schilli, m@perlmeister.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.

2009-10-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.