Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Why cant I connect through a proxy using perl?

by Anonymous Monk
on Nov 04, 2001 at 01:42 UTC ( #123085=categorized question: print w/replies, xml ) Need Help??
Contributed by Anonymous Monk on Nov 04, 2001 at 01:42 UTC
Q&A  > HTTP and FTP clients


Well, I had in mind to let my program connect to a server through a proxy.

For this, I'm using LWP::UserAgent. Though my problem is that regardless of what proxy I use, I cant connect out. If I "remove" the proxy, everything works fine, but not with it.

I believe the problem has something to do with the "no_proxy" definition.

$ua->proxy('http', ''); $ua->no_proxy('');

Anyone have any idea of what Im doing wrong?

Thanks in advance

Edited by footpad, ~Sun Nov 25 04:28:22 2001 (GMT)

Answer: Why cant I connect through a proxy using perl?
contributed by IlyaM

I don't know what the reason of your problem but often turning on debug trace in LWP helps to debug problems with LWP.

Try to add

use LWP::Debug qw(+);

into you program and see what happens when it tryes to talk with proxy. See LWP::Debug docs for more info about LWP debug tracing.

Answer: Why cant I connect through a proxy using perl?
contributed by redbrick

Mmm... I am also new to this stuff, but while I was wandering around hacking deluge (a web stress tool, I found the following code:


where $ua is an instance of UserAgent. And in the UserAgent pod, I found that this command imports proxy settings from the following enviroment vars: http_proxy and ftp_proxy.

Hope that this works for you.

Please (register and) log in if you wish to add an answer

  • 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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [Corion]: LanX: Ow ;)
    Discipulus manual work: i just tell the same to my boss: every time the quick solution is to assign some manual data entry task to my group.. because we have not direct access to many databases here..
    [LanX]: point is: in high speed trade each bank has to remember what he has to get from the others... so dresdner got billed for losses but couldn't claim gains
    Discipulus is this the IT?
    [Corion]: Discipulus: Well, in many cases it doesn't make sense to build an interface and complicated program just to enter 20 rows into a database ;) But yes, automating data imports should pay off in the long run
    [LanX]: Choroba: this happened before I joined, was still in uni, but my boss was summoned to the CEO of the second biggest German bank at that time and could only say " I told them its not ready" ;)

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (9)
    As of 2017-03-29 12:02 GMT
    Find Nodes?
      Voting Booth?
      Should Pluto Get Its Planethood Back?

      Results (350 votes). Check out past polls.