Search code examples
perlmechanizeperl-modulewww-mechanize

Perl Mechanize throwing connection error while using proxy


I am trying to download pdf files present in a website using perl MECHANIZE module. It worked fine when i am running the program without any proxy connection. But i am getting the below error when i tried to run the program on the company server which uses proxy connection.

error:

Error GETing http://www.google.com: Can't connect to www.google.com:80 (10060) a t Download.pl line 20.

I am not sure if i need to add any proxy details in the program or Is this something that our company firewall is blocking programatical requests to a website ? I have tried a lot but coudn't find out. Can any one of you please suggest?


Solution

  • If you using some kind of LWP related module you could set the following shell variables

    HTTP_PROXY=your.corp.proxy:your_proxy_port

    You could check the connection with telnet or with wget

    telnet www.google.com 80
    

    with wget

    wget http://www.google.com