fourmi has asked for the wisdom of the Perl Monks concerning the following question:

hi, I've got the following code:
#!/usr/local/bin/perl use strict; use CGI; my ($CgiVar) = CGI->new; require HTTP::Request; require URI::URL; require LWP::UserAgent; sub GetURL; my $Response = GetURL('https://www-test.pubs.recordsmanagement.ed.ac.u +k/public/'); print "Content-type: text/html\n\n"; print "$Response"; sub GetURL { my ($inURL) = @_; my ($ua, $request, $response); $ua = new LWP::UserAgent; $request = new HTTP::Request 'GET', $inURL; $response = $ua->request($request); if ($response->is_success) { return $response->content; } else { return $response->error_as_HTML; } }
Which won't process https, what do i need to do to get around/solve this? It's probably very simple, but I've got a deadline today and way too much else to be getting on with rather than tracking it down myself. If anyone has a quick fix, that'd be great..
TIA
ant

Replies are listed 'Best First'.
Re: Getting HTTPS source
by gellyfish (Monsignor) on Aug 06, 2004 at 10:18 UTC

    You need IO::Socket::SSL or Net::SSLeay to get SSL protected web sites - LWP will just detect the presence of these modules and do the right thing.

    /J\

      thanks for that, could you elaborate? i 'use'd those, but it said something about them not being in @INC...

        Er yes, they have to be installed - but beyond that you don't have to do anything else as LWP detects that they are there if it needs them to use the 'https' protocol scheme, you don't say what platform you on but you should either use CPAN or PPM to install the modules correctly.

        /J\