How can I make a JSON POST request with LWP?

You’ll need to construct the HTTP request manually and pass that to LWP. Something like the following should do it: my $uri = ‘https://orbit.theplanet.com/Login.aspx?url=/Default.aspx’; my $json = ‘{“username”:”foo”,”password”:”bar”}’; my $req = HTTP::Request->new( ‘POST’, $uri ); $req->header( ‘Content-Type’ => ‘application/json’ ); $req->content( $json ); Then you can execute the request with LWP: my $lwp = LWP::UserAgent->new; … Read more

How can I get LWP to validate SSL server certificates?

This long-standing security hole has finally been fixed in version 6.00 of libwww-perl. Starting with that version, by default LWP::UserAgent verifies that HTTPS servers present a valid certificate matching the expected hostname (unless $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} is set to a false value or, for backwards compatibility if that variable is not set at all, either $ENV{HTTPS_CA_FILE} or … Read more