潘蓝兰 > Novel-Robot-Browser > Novel::Robot::Browser

Download:
Novel-Robot-Browser-0.14.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.14   Source  

NAME ^

Novel::Robot::Browser 自动化获取网页内容,并解码为unicode

FUNCTION ^

request_url

    my $browser = Novel::Robot::Browser->new();

get

    my $url = 'http://www.jjwxc.net/onebook.php?novelid=2456';
    my $content_get_ref = $browser->request_url($url);

post

    my $form_url = 'http://www.jjwxc.net/search.php';
    my $post_data = {
                'key1' => 'value1', 
                'key2' => 'value2', 
    };
    my $content_post_ref = $browser->request_url($form_url, $post_data);

request_urls

    my $src_arr = [ 'http://www.ustc.edu.cn', 'http://202.38.64.10' ];
    my $res = $browser->request_urls( $src_arr, 
        deal_sub => sub { 
            my ($r, $data) = @_; 
            return { url => $r, length => length($$data) };
        }, 
        #request_sub => sub {
        #my ($r) = @_;
        # ...
        #return $data;
        #},
    ); 
syntax highlighting: