I'm trying to download some statistics from
http://www.statistics.gov.uk/STATBASE/tsdataset.asp?vlnk=7174 and all I want to get WWW::Mechanize to do is click on the button which says 'Display Complete Dataset'. I think this may in fact be some kind of cookie/session problem, because I've tried several different ways and they all result in me being redirected to the 'Customise Dataset' page unless I browse to the page I want using IE6.
Here's one of the methods I've tried:
$url = 'http://www.statistics.gov.uk/STATBASE/tsdataset.asp?vlnk=7174'
+;
$mech = WWW::Mechanize->new();
$mech->agent_alias( 'Windows IE 6' );
$mech->get($url);
$mech->click(B3,1,1);
$_ = $mech->content();
print $_;
This doesn't work because the button is disguised as a clickable image. Have also tried:
$mech->submit_form(
form_name => 'form1',
);
And i tried a couple of other things. I've also tried chaing the referer, and alias, neither work, I also tried cacthing the cookie in a cookie jar without success. If it is a cookie problem, why is Perl not caching this automatically for me? I would really appreciate some help on this as it's driving me completely crazy. Please email rob@hostpipe.co.uk with suggestions as am having trouble typing tonight, damaged hand playing rugby...oops!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.