Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Need help with HTTP::Proxy

by sunslinger (Initiate)
on Jul 04, 2006 at 07:22 UTC ( #559101=perlquestion: print w/ replies, xml ) Need Help??
sunslinger has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys,

I'm a newbie here with this particular problem. I'm currently using Win2K and am trying to use the WWW::Mechanize and HTTP::Proxy in order to submit a simple form where a proxy server address is required.

Here's my code:

my $proxy = HTTP::Proxy->new( host => 'proxy.somewhere.com', port => 80, );

When I try to compile it, I get this error at dos prompt:

"Cannot initialize proxy daemon: Unknown error at C:/Perl/lib/HTTP/Pro +xy.pm line 268."

Please help!

Code tags added by GrandFather

Comment on Need help with HTTP::Proxy
Select or Download Code
Re: Need help with HTTP::Proxy
by Corion (Pope) on Jul 04, 2006 at 07:32 UTC

    Most likely, the proxy.somewhere.com address cannot be bound to an interface of your network card. Make sure that proxy.somewhere.com resolves to the machine you run your proxy on and that one network interface handles the IP address.

    But why are you setting the host parameter at all? It shouldn't be necessary - try your code without it, or try giving it an IP address instead of a hostname, to eliminate DNS weirdness.

Re: Need help with HTTP::Proxy
by shmem (Canon) on Jul 04, 2006 at 10:28 UTC
    HTTP::Proxy is used to setup a proxy on your machine, which is probably not what you want.

    If the submit request must go over a remote proxy, set the environment variable http_proxy or include the following snippet in your script:

    $ENV{'http_proxy'} = 'http://proxy.somewhere.com:80/';

    --shmem

    _($_=" "x(1<<5)."?\n".q/)Oo.  G\        /
                                  /\_/(q    /
    ----------------------------  \__(m.====.(_("always off the crowd"))."
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: Need help with HTTP::Proxy
by planetscape (Canon) on Jul 04, 2006 at 13:04 UTC
      Hi planetscape, I think you're spot on with my dilemma. Sorry if I wasn't clear enough as I'm really, really new with this. I tried the WWW::Mechanize via $mech->proxy(etc.) and compilation is ok. Then when I try to load the page $mech->get($url); I get this run-time(?) error:- Error GETing http://home/intranet/soemthing.htm: Proxy Authentication Required. The ISA server requires authorization to fulfill the request. Access to the Web Proxy service is denied. > at mech.pl at line 27 So basically I'm trying to get WWW::Mechanize to submit a form (I think) but the html page is behind my office's proxy and it prompts me for authentication. Please help!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://559101]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2014-07-22 10:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (109 votes), past polls