Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: LWP::Simple request through a proxy

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


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 Anonymous Monk on May 25, 2004 at 10: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.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://350299]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-07-21 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.