use WWW::Mechanize; use Storable; #------------------------------------------------------------------------------ # Define Variables for this process #------------------------------------------------------------------------------ # File Down load path is used as a varible: $DownloadFilePath= $DownloadFilePath="D:\\LIPAPSM\\DSSourcefiles\\"; #============================================================================== # START OF PROGRAM #============================================================================== $one_day = 60*60*24 ; my($day, $month, $year) = (localtime time+$one_day)[3,4,5]; $month = sprintf '%02d', $month+1; $day = sprintf '%02d', $day; $Datetotal=($year+1900).$month.$day; $filedate=join "", $Datetotal."damlbmp_zone.csv"; $url = join "",'http://mis.nyiso.com/public/csv/damlbmp/'.$filedate; $m = WWW::Mechanize->new(autocheck => 1); $m->get($url); $filename=join "",$DownloadFilePath.$filedate; $m->save_content($filename);