#!/usr/bin/perl -w use strict; use WWW::Mechanize; my $login = "admin"; my $password = "pass"; my $url = "http://abc.xyz.com"; my $mech = WWW::Mechanize->new(); $mech->get($url); #Log in print "\n\n\n\nLogging in.... \n\n\n\n"; $mech->submit_form( form_number => 1, fields => { user => $login, password => $password }, ); #Navigate to the download page $mech->follow ( 'Download' ); if ($mech->success) { #this page has only one form with the "download" button. #Download is for a zip file. $mech->click(); if ($mech->success) { my $filename = 'E:\Dhanashri\down.zip'; $mech->save_content ( $filename ); print "\nFile Downloaded!\n\n"; } else { print "\nDownload Failed!\n"; } } print "Logging out...\n"; $mech->follow ( 'logout' );