NAME

WWW::SpiTract::Spider - Simplified WWW User Agent

SYNOPSIS

use WWW::SpiTract::Spider;
$s = new WWW::SpiTract::Spider({
  URL         => 'http://foo.bar/',
  METHOD      => 'PLAIN',
  PARAM       => [ [ 'paramA', 'valueA' ] ],
  QUERY       => [ querykey, queryvalue],
  HTTP_PROXY  => 'http://foo.bar:2345/',
  TIMEOUT     => 10,
});

print $s->content;

DESCRIPTION

WWW::SpiTract::Spider is a simplified module for web page retrieval, and is designed mainly for WWW::SpiTract. Many features of LWP are excluded from here.

METHODS

new

$s = WWW::SpiTract::Spider->new({
  URL         => 'http://foo.bar/',
  METHOD      => 'PLAIN',                     # default is 'GET'
  QUERY       => [ querykey, queryvalue ],    # user's query
  PARAM       => [ [ 'paramA', 'valueA' ] ]   # other parameters
  TIMEOUT     => 5,                           # 10 if undef
  USERAGENT   => 'WWW::SpiTract::Spider'      # becomes Mozilla if undef
  HTTP_PROXY  => 'http://foo.bar:2345/',
});

And, it is better not to mix URL and its parameters together.

content

$s->content() returns url's content if success. Or it returns undef

content_to_file

$s->content_to_file(FILENAME_HERE) dumps content to a file

OTHER TOOLS

WWW::SpiTract::Spider::queryURL({
    URL         => $url,
    METHOD      => 'POST,
    PARAM       => [ [ 'paramA', 'valueA' ] ],
    QUERY       => [ querykey, queryvalue],
});

returns a GET-like URL for debugging or other uses, even request method is POST.

AUTHOR

xern <xern@cpan.org>

LICENSE

Released under The Artistic License.

SEE ALSO

WWW::SpiTract, WWW::SpiTract::Extract, LWP