#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use WWW::Mechanize; use Readonly; use HTML::TreeBuilder; #use HTML::Element qw(Table); #use HTML::TableExtract qw(tree); use HTML::TableExtract; use HTML::Encoding 'encoding_from_http_message'; use Encode; use File::Slurp; Readonly::Scalar my $url => 'http://www.emarketplace.state.pa.us/Search.aspx'; my $mech = WWW::Mechanize->new( agent => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2' ); $mech->get($url); #There is only one form on the page and they start at 1 in WWW:Mechanize my $form = $mech->form_number(1); # 'wucSearch$btnSearch' is the NAME of the button we want to press; 'wucSearch_btnSearch' is the id # 'wucSearchResults$ddlRows' is the NAME of the input item we want to set to 'ALL' $mech->select('wucSearchResults$ddlRows','ALL'); my $response = $mech->click_button(name => 'wucSearch$btnSearch'); if ($response->is_success) { #print $response->decoded_content; # or whatever } else { die $response->status_line; } my $HTML = $response->decoded_content; #my $te = HTML::TableExtract->new(slice_columns=> 0, keep_html => 1);#, headers => ["Solicitation#"]); my $te = HTML::TableExtract->new(); $te->parse($HTML);