#initialise browser object $browser = WWW::Mechanize->new(autocheck =>1, noproxy =>1); # Add cookie jar $browser->cookie_jar(HTTP::Cookies->new()); $browser->agent_alias('Linux Mozilla'); .... $browser->get($collabnetArtifactURL); #Serach and follow the file / doc link in collabnet $tmpURL = $browser->find_link(tag=>'a',url_regex => qr/\/sf\/(docman|frs)\/do\/(downloadDocument|downloadFile)\/.*\/$artID/)->url_abs(); $tmpURL.='/'.$collabnetFileVersion if ($collabnetFileVersion ne ''); print "\n INFO: URL: $tmpURL"; #print "\n ", Dumper($response) , "\n"; $response = $browser->get($tmpURL); if ($browser->success()) { if ($collabnetFileName eq '') { $collabnetFileName = $response->filename() || $artID; } $browser->save_content($collabnetFileName); if (-s $collabnetFileName) { print "\n INFO: $collabnetFileName is downloaded"; } else { print "\n ERROR: $collabnetFileName is NOT downloaded"; } } .... #### use strict; use warnings; use Crypt::SSLeay; use Net::SSL; use WWW::Mechanize; use HTTP::Cookies; .... $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL"; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; ... # Same above code