perl_help26 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to call a URL that causes the download of a csv file (when accessed from the browser). This is my code:

use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get ("http://localhost/market.php?Username=admin&Password=admin +&action=Smartphone"); $mech->save_content( 'file.csv );

Only when I do this, the raw HTML is saved into my file instead of the content of the file that needs to be downloaded... What am I doing wrong??? Thanks

Replies are listed 'Best First'.
Re: Using WWW::Mechanize to save contents of downloaded file
by Anonymous Monk on Dec 30, 2014 at 11:34 UTC
      Thank you so much ...I ended up with this code :
      $mech->get ($Url,':content_file' => 'filename.csv'); $mech->get( 'filename.csv' );