#!/usr/local/bin/perl use strict; use warnings; use LWP; use HTML::TreeBuilder; use HTML::FormatText; use HTTP::Cookies; my $url = 'https://timetables.website.x.y.z/dir/'; my $cookie_jar = HTTP::Cookies->new(); my $browser = LWP::UserAgent->new(); $browser->cookie_jar($cookie_jar); $browser->agent('Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0)'); $browser->from('my email'); $browser->protocols_allowed( ['https'] ); #User Credentials for access to the website.x.y.z realm. $browser->credentials( 'timetables.website.x.y.z:443', #website and port 'timetables.website.x.y.z', #realm 'user' => 'pass' # user credentials ); my $response = $browser->get($url); die "Error at $url\n ", $response->status_line, "\n Aborting" unless $response->is_success; print "OK", $response->content_type, " document!\n"; my $content = $response->decoded_content; my $html = new HTML::TreeBuilder; $html->parse($content); my $f = new HTML::FormatText(leftmargin => 0, rightmargin => 0); print $f->format($html);