[Chicago-talk] re: Downloading a file via WWW::Mechanize [solved by Leland Johnson]

Jay Strauss me at heyjay.com
Wed Oct 6 08:56:59 CDT 2004


Just to close this thread.  Leland Johnson showed me how to do this.  It 
turns out it was more complex than it appeared.  While Andy wanted to 
beat me up and accuse me of not reading the docs, it turns out the 
javascript was re-writing the action of the page, so I was asking the 
wrong page to do what I wanted.

Below is the solution, and I just wanted to publicly thank Leland for 
his help.


my $ticker = 'qqq';

use WWW::Mechanize;
my $url = "http://www.cboe.com/DelayedQuote/QuoteTableDownload.aspx";

my $mech = WWW::Mechanize->new();
$mech->get( $url );

# Set the form as best we can through the easy methods
$mech->set_fields( ticker => $ticker);

# Here's where we do what the javascript does
my $form = $mech->current_form;


# Send off the request
my $request = $form->click;
$mech->request($request, "$ticker.txt");

More information about the Chicago-talk mailing list