Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Can't connect to https using LWP::UserAgent

by madtoperl (Hermit)
on Feb 08, 2017 at 07:10 UTC ( [id://1181372]=note: print w/replies, xml ) Need Help??


in reply to Can't connect to https using LWP::UserAgent

you can try below if you are not doing SSL validation,
untested though since I do not have permission to install Net::SSL module in my box
use strict; use warnings; use LWP::UserAgent; use HTTP::Request::Common qw(GET); use Net::SSL; my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0}, ); my $req = GET 'https://ptabdata.uspto.gov/ptab-api/documents'; my $res = $ua->request($req); if ($res->is_success) { print $res->content; }else{ print $res->status_line . "\n"; }

Replies are listed 'Best First'.
Re^2: Can't connect to https using LWP::UserAgent
by ruqui (Acolyte) on Feb 08, 2017 at 10:24 UTC
    Your solution works for me! Thank you! Do you know why this works when my initial attempt failed? (I'd like to know what I did wrong)
      The key was disabling the verify_hostname option to the https handler. You probably should install Mozilla::CA as per the LWP::Protocol::https documentation so that you can verify the certificates presented by the server.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1181372]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found