Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: WWW::Mechanize and proxy with username/password

by perlhack (Acolyte)
on Jun 26, 2003 at 18:33 UTC ( #269356=note: print w/replies, xml ) Need Help??


in reply to Re: WWW::Mechanize and proxy with username/password
in thread WWW::Mechanize and proxy with username/password

Michael,
I need to authenticate with a username and password with my proxy. I think your code does not have this part which is my problem.

tcf22,
Yes I saw the comment in WWW::Mechanize about the subclass of LWP::UserAgent but if LWP::UserAgent doesn't really support the username/password part of the proxy directly then I dont know if it will work with WWW::Mechanize.

I was able to take my code and replace LWP::UserAgent with WWW::Mechanize to do a get or fetch of a web page and that worked ok. But the other "Mechanize" capabilities of WWW::Mechanize dont seem to remember or inherit or know how to pass my username and password with its requests to the web via the proxy server.

There must be a way but I cant seem to figure it out and haven't been able to find an example WWW::Mechanize script that has proxy with username/password code shown. I guess that is why I am seeking some wisdom.

Thanks.

  • Comment on Re: Re: WWW::Mechanize and proxy with username/password

Replies are listed 'Best First'.
Re: Re: Re: WWW::Mechanize and proxy with username/password
by Corion (Pope) on Jun 26, 2003 at 18:36 UTC

    At work, I have set $ENV{HTTP_PROXY} to http://login:password@proxyserver, and it magically works :

    use strict; use WWW::Mechanize; my $agent = WWW::Mechanize->new(); $agent->env_proxy(); $agent->get('http://www.google.com'); print $agent->content;
    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://269356]
help
Chatterbox?
[thao4]: posted with the title :Replace a patern_2 in 30 lines from the line with the patern_1 founded
[Eily]: karlgoethebier but we're trying to stay hidden!
[shmem]: thao4 example of the text and program missing in your post
[Eily]: also you can use <p> or <br /> tags to have multiple lines
[hippo]: Please also take a moment to read through I know what I mean. Why don't you? - this guidance will help others to help you.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2018-02-21 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (277 votes). Check out past polls.

    Notices?