Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

403 forbidden lwp proxy https

by gabrielsousa (Sexton)
on Oct 06, 2017 at 15:51 UTC ( #1200838=perlquestion: print w/replies, xml ) Need Help??
gabrielsousa has asked for the wisdom of the Perl Monks concerning the following question:

i get 403 forbidden when trying to GET a request using https proxy
use warnings; use strict; use HTTP::Response; use LWP::UserAgent; use LWP::Debug qw(+); use HTTP::Request; use JSON; use Data::Dumper; use DateTime; my ($ua,$url,$req,$res,$mail,$decode,$code,$jsond,$date,$startsec,$fin +ishsec,$diffsec); $mail = ' +pt/messages/?$select=Sender,Subject'; $ua = LWP::UserAgent->new(keep_alive => 1,); $ua->agent('Mozilla/5.0'); $ua->proxy(['https'], ""); $ua->timeout(1); $req = HTTP::Request->new(GET => $mail); $req->authorization_basic('login','pass'); $req->header(Host => ''); $res = $ua->request($req); print STDERR ("[DEBUG]: RESPONSE =" .Dumper \$res );

Replies are listed 'Best First'.
Re: 403 forbidden lwp proxy https
by gabrielsousa (Sexton) on Oct 06, 2017 at 18:00 UTC
    found the solution
    use LWP::Protocol::connect; $ua->proxy(['https'], "connect://");

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1200838]
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-07-20 05:25 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (424 votes). Check out past polls.