title: NTLM Proxy Auth in perl
body: <p>I need to access internet page via proxy.
  I need to used NTLM or Digest Auth Scheme</p>
  
  <p>The code i get on googling doesn't work.</p>
  
  <p>Below code is making web request with any Auth Header.
  Please help me to get webpage via NTLM proxy auth.</p>
  
  <pre><code>GET (URL address blocked: See forum rules) HTTP/1.1
  TE: deflate,gzip;q=0.3
  Keep-Alive: 300
  Connection: Keep-Alive, TE
  Host: google.com
  User-Agent: libwww-perl/6.02
  
  
  my $ua = new LWP::UserAgent(keep_alive =&gt; 1);
  $ua-&gt;proxy('http', $PROXY);
  $ua-&gt;credentials('proxy', '', 'username','passwd');
  ntlmv2(1);
  
  my $req = GET  $url;
  print "--Peforming request now...---------\n";
  
  my $res = $ua-&gt;request($req);
  if ($res-&gt;is_success) {
      print $res-&gt;content;
  } else {
      print "Error: " . $res-&gt;status_line . "\n";
      print $res-&gt;headers()-&gt;as_string(), "\n";
  }
  </code></pre>