Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to scrape this page and seems i cant get the valid '__VIEWSTATE' or even '__EVENTVALIDATION' (fields), here's my code:
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 => '__EVENTVALIDATION'); 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();
Someone from this page said that 'encode' will solve the problem, i just have no idea what he means with 'encode'.
thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: scraping ASP page, __VIEWSTATE problem
by Anonymous Monk on Aug 07, 2009 at 18:57 UTC | |
|
Re: scraping ASP page, __VIEWSTATE problem
by Anonymous Monk on Aug 08, 2009 at 08:37 UTC | |
by Gangabass (Vicar) on Aug 09, 2009 at 12:08 UTC | |
|
Re: scraping ASP page, __VIEWSTATE problem
by Anonymous Monk on Aug 08, 2009 at 03:31 UTC | |
|
Re: scraping ASP page, __VIEWSTATE problem
by Anonymous Monk on Aug 08, 2009 at 03:32 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |