use strict; use warnings; use LWP::Debug qw(+); use WWW::Mechanize; use HTML::HeadParser; use Crypt::SSLeay; # added per suggestion by zentara require HTML::HeadParser; my $mech = WWW::Mechanize->new(cookie_jar => {}, autocheck => 0); $mech->agent_alias( 'Windows Mozilla' ); $mech->get('https://www.google.com'); print "\n", $mech->uri(); print "\n", $mech->status(); print "\n", $mech->text(); print "\n" . $mech->success(); while (my ($key, $value) = each(%INC)) { print "$key\n"; } #### Can't connect to www.google.com:443 #### pp -x mech_test.pl #### use strict; use warnings; use LWP::UserAgent; use LWP::Debug qw(+); use HTML::HeadParser; use Crypt::SSLeay; use Data::Dumper; my $ua = LWP::UserAgent->new; $ua->agent("LWP"); my $request = HTTP::Request->new(GET => "https://www.google.com"); my $result = $ua->request($request); print Dumper($result); #### $VAR1 = bless( { '_protocol' => 'HTTP/1.1', '_content' => 'Googlegoogle.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};


Go to classic Google.
 
Advanced searchLanguage tools

Learn more about searching on Google with SSL.

< a href="/intl/en/ads/">Advertising ProgramsBusines s SolutionsAbout Google

© 2011 - Pr ivacy

', '_rc' => '200', '_headers' => bless( { 'x-meta-robots' => 'noodp', 'connection' => 'close', 'set-cookie' => [ 'PREF=ID=b14a5245a42e2 690:FF=0:TM=1313519237:LM=1313519237:S=2UrJQIn2iwHfYVhL; expires=Thu, 15-Aug-201 3 18:27:17 GMT; path=/; domain=.google.com', 'NID=50=yPFC219p-nOY5I OAn_eti4fudJhMTDntXxtug11Qi0BiA0mg4lISBDL1mDrTKSAJ5N2ELexXeTanS-pq21rF_vUO1zYpWj f2DtMHgxuv4dwJzBbM8CpRwfb3q7eaxsF6; expires=Wed, 15-Feb-2012 18:27:17 GMT; path= /; domain=.google.com; HttpOnly' ], 'cache-control' => 'private, max-age=0', 'date' => 'Tue, 16 Aug 2011 18:27:17 GMT ', 'client-ssl-cert-issuer' => '/C=US/O=Goo gle Inc/CN=Google Internet Authority', 'client-ssl-cipher' => 'RC4-SHA', 'client-peer' => '74.125.229.36:443', 'client-date' => 'Tue, 16 Aug 2011 18:27 :09 GMT', 'content-type' => 'text/html; charset=IS O-8859-1', 'x-xss-protection' => '1; mode=block', 'server' => 'gws', 'client-ssl-socket-class' => 'IO::Socket ::SSL', 'x-meta-description' => 'Search the worl d\'s information, including webpages, images, videos and more. Google has many s pecial features to help you find exactly what you\'re looking for.', 'client-response-num' => 1, 'client-ssl-cert-subject' => '/C=US/ST=C alifornia/L=Mountain View/O=Google Inc/CN=*.google.com', 'title' => 'Google', 'expires' => '-1' }, 'HTTP::Headers' ), '_previous' => bless( { '_protocol' => 'HTTP/1.1', '_content' => ' 302 Moved

302 Moved

The document has moved here. ', '_rc' => '302', '_headers' => bless( { 'connection' => 'close', 'set-cookie' => 'PREF=ID=4be28478f8645887:FF=0:TM=1313519237:LM=1313519237:S=_s3v6fPd4ugYkCvi; e xpires=Thu, 15-Aug-2013 18:27:17 GMT; path=/; domain=.google.com', 'cache-control' => 'private', 'date' => 'Tue, 16 Aug 2011 18:27:17 GMT', 'client-ssl-cert -issuer' => '/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA', 'client-ssl-ciph er' => 'RC4-SHA', 'client-peer' => '74.125.229.51:443', 'client-date' => 'Tue, 16 Aug 2011 18:27:09 GMT', 'content-type' = > 'text/html; charset=UTF-8', 'x-xss-protectio n' => '1; mode=block', 'server' => 'gws ', 'client-ssl-sock et-class' => 'IO::Socket::SSL', 'location' => 'h ttps://encrypted.google.com/', 'client-response -num' => 1, 'content-length' => '226', 'client-ssl-cert -subject' => '/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com ', 'title' => '302 Moved' }, 'HTTP::Headers' ), '_msg' => 'Found', '_request' => bless( { '_content' => '' , '_uri' => bless( do{\(my $o = 'https://www.google.com')}, 'URI::https' ), '_headers' => bl ess( { 'user-agent' => 'LWP' }, 'HTTP::Headers' ), '_method' => 'GE T', '_uri_canonical' => bless( do{\(my $o = 'https://www.google.com/')}, 'URI::https' ) }, 'HTTP::Request' ) }, 'HTTP::Response' ), '_msg' => 'OK', '_request' => bless( { '_protocol' => undef, '_content' => '', '_uri' => bless( do{\(my $o = 'https://e ncrypted.google.com/')}, 'URI::https' ), '_headers' => bless( { 'user-agent' => ' LWP' }, 'HTTP::Headers' ), '_method' => 'GET', '_uri_canonical' => $VAR1->{'_request'}{ '_uri'} }, 'HTTP::Request' ) }, 'HTTP::Response' ); ##
## $VAR1 = bless( { '_content' => 'Can\'t connect to www.google.com:443 ', '_rc' => 500, '_headers' => bless( { 'client-warning' => 'Internal response', 'client-date' => 'Tue, 16 Aug 2011 18:27 :24 GMT', 'content-type' => 'text/plain' }, 'HTTP::Headers' ), '_msg' => 'Can\'t connect to www.google.com:443', '_request' => bless( { '_content' => '', '_uri' => bless( do{\(my $o = 'https://w ww.google.com')}, 'URI::https' ), '_headers' => bless( { 'user-agent' => ' LWP' }, 'HTTP::Headers' ), '_method' => 'GET' }, 'HTTP::Request' ) }, 'HTTP::Response' );