Update, here's the code
#!/usr/bin/perl use strict; use warnings; use HTML::TreeBuilder; use WWW::Mechanize; use URI::Escape; my $agent = WWW::Mechanize->new(); $agent->get('http://www.usgbc.org/myUSGBC/Members/MembersDirectory.asp +x?PageID=2011&CMSPageID=140'); $agent->form_name('frmMemberDirectory'); $agent->field('ddlCategory', ''); $agent->field('ddlState', ''); $agent->field('ddlCountry', 'US'); $agent->field('txtCompanyName', ''); $agent->click('btnSearch'); my $node = HTML::TreeBuilder->new(); $node->parse( $agent->content ); my $val_id = $node->find_by_attribute( id => '__VIEWSTATE'); my $validation = $val_id->attr('value'); my $state_id = $node->find_by_attribute( id => '__EVENTVALIDATION'); my $view_state = $state_id->attr('value'); $validation = uri_escape( $validation ); $view_state = uri_escape( $view_state ); my $id = '__EVENTTARGET=dgMembers%24ctl01%24ctl11&__EVENTARGUMENT=&__V +IEWSTATE='. $view_state . '&txtCompanyName=&ddlCategory=&ddlState=&ddlCountry=US&__EVENT +VALIDATION='. $validation; $agent->post('http://www.usgbc.org/myUSGBC/Members/MembersDirectory.as +px?PageID=2011&CMSPageID=140', Content => $id); print $agent->content();
In reply to Re: scraping ASP page, __VIEWSTATE problem
by Anonymous Monk
in thread scraping ASP page, __VIEWSTATE problem
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |