Thank you everyone for your replies and patience. But my program doesn't work. Here is my code

use strict; use warnings; use LWP::UserAgent; my $content; my $ua = new LWP::UserAgent; $ua->proxy(['http'], 'http://my_username:my_pwd@proxy.mycompany.intran +et/autoproxy:8080/'); $ua->agent("Mozilla/6.0"); my $req = new HTTP::Request(GET => 'http://www.perlmonks.com/'); my $res = $ua->request($req); print $res->content if ($res->is_success);

I also tried another variation. I set 3 environment variables HTTP_PROXY=http://proxy.mycompany.intranet/autoproxy:8080/
HTTP_proxy_pass=my_username
HTTP_proxy_user=my_pwd

Now I changed the code to
use strict; use warnings; use LWP::UserAgent; my $content; my $ua = new LWP::UserAgent; $ua->env_proxy(); $ua->agent("Mozilla/6.0"); my $req = new HTTP::Request(GET => 'http://www.perlmonks.com/'); my $res = $ua->request($req); print $res->content if ($res->is_success);

It still didn't work!

When I run this program it does not print the contents of the perlmonks page. It prints a script file on my console. This is exactly the same output which I used to get in my C# program till I had configured the proxy authentication properly.

Currently the output of running my perl code is

function FindProxyForURL (url, host) { if ( shExpMatch (host, "127.0.0.1") || isPlainHostName(host) || dnsDomainIs(host,"mycompany.intranet") || shExpMatch(host,"xy.xyz.*") || ) return "DIRECT"; return "PROXY proxy.mycompany.intranet:8080"; }

Regarding starting a new thread and not posting it to the old one, I did so because I was afraid, that if i post on the old thread no one will read it unless they go down to that date. If i start a new one then it will appear in the newest node where there is more probability of monks reading my question.

regards,
Abhishek.


In reply to Re: Re: authenticate to a proxy server [Again!] by abhishes
in thread authenticate to a proxy server [Again!] by abhishes

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.