perlquestion
Random_Walk
<p>Most esteemed monks,<br><br>
I have a script pulling back CMDB info from service now using REST API. works a treat on my windows laptop where developed. Move it to Linux and I get a 400 back. I have cut things all the way back and found it is not REST issue, but even a basic LWP get is failing. Here is my test script that work on win, fails on lin.
</p>
<code>
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->proxy('https', $ENV{HTTPS_PROXY});
my $response = $ua->get('https://google.com/');
if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}
</code>
Here is the curl test
<code>
myaccount@linuxhost:~> curl https://www.google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://www.google.se/?gfe_rd=cr&ei=XwaLWMjfB6Sr8weh06_QDQ">here</A>.
</BODY></HTML>
</code>
My HTTPS_PROXY is set, and I can pull back https://google.com with curl. What magic do I miss?
<p>Cheers,<br>R.</p>
<div class="pmsig"><div class="pmsig-382261">
Pereant, qui ante nos nostra dixerunt!
</div></div>