Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Welcome to the Monastery
 
PerlMonks  

Re: LWP::Simple request through a proxy

by Abigail-II (Bishop)
on May 04, 2004 at 08:05 UTC ( [id://350299]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to LWP::Simple request through a proxy

Your code isn't doing an LWP::Simple request. It's doing its request through LWP::UserAgent (LWP::Simple will use LWP::UserAgent itself as well). Do one to three things:
  • Forget about LWP::Simple. You seem to cope with LWP::UserAgent fine.
  • Use LWP::Simple, and have it export $ua. Set up the proxy through $au, as in your code (But the method above is just as easy).
  • Either use LWP::UserAgent or LWP::Simple as described above, and setup the proxy using environment variables and a call to $au -> env_proxy.
Futher note that the second argument of the proxy method must be the proxy you are using - not the site you want to reach via a proxy.

Abigail

Replies are listed 'Best First'.
Re: Re: LWP::Simple request through a proxy
by freak (Initiate) on May 04, 2004 at 11:59 UTC
    ok, How to make LWP::Simple to use a proxy (without LWP::UserAgent) OR what should the script be if LWP::Simple uses an LWP::UserAgent proxy ?
      You asked this question in this newer node: Re: How to make LWP::Simple use a proxy?, it's answered there.

      PS: try to make all your node-titles a bit more descriptive. In my opinion LWP::Simple request through a proxy is a good example of a node title, Connections is not.

Re: Re: LWP::Simple request through a proxy
by Anonymous Monk on May 25, 2004 at 06:51 UTC
    Step two above is exactly what I wanted but I wasn't quite sure exactly what was required but I am now so for others for future reference:
    # use proxy (comment out if not) my %proxy = ( host => 'http://proxy:8080' ); use LWP::Simple qw(mirror RC_OK RC_NOT_MODIFIED $ua); $ua->proxy(http => "$proxy{host}") if (defined $proxy{host});
    You can see I'm just interested in using mirror.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://350299]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.