15. Form submission
my $mech = WWW::Mechanize->new();
$mech->get("http://sfbay.craigslist.org/ela/");
$mech->field ('catAbb', 'ela');
$mech->field ('query', 'playstation');
$mech->field ('maxAsk', 300);
$mech->submit();
my @links = $mech->find_all_links(
text_regex => qr{playstation}i,
);
print join "", map { $_->text() . "n" } @links;
16. Form submission (2)
my $mech = WWW::Mechanize->new();
$mech->get("http://sfbay.craigslist.org/ela/");
my @forms = $mech->forms;
my $form = $forms[0];
my $action = $form->action;
my @inputs = $form->inputs;
my @names = $form->param;
17. Follow Next Link
my $mech = WWW::Mechanize->new();
my $url = "http://sfbay.craigslist.org/ela";
$mech->get($url);
my $uri = $mech->uri;
print "uri: $urin";
my $i = 0;
while ($i < 10 && $mech->follow_link (text => 'next >')) {
#print Dumper $link;
$uri = $mech->uri;
print "uri: $urin";
$i++;
}
20. Legality
I'm not a lawyer
User agreements may object to screen scraping
Ebay has sued a notorious screen scraper
Online-games will almost always ban you