Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Cannot connect using LWP :behind Proxy

by William G. Davis (Friar)
on Dec 29, 2004 at 06:49 UTC ( #417933=note: print w/replies, xml ) Need Help??


in reply to Cannot connect using LWP :behind Proxy

Hi. First, you should really wrap all of your code in <code></code> tags when you post it here so it displays correctly. Here's your code reposted using <code> tags:

#!/usr/bin/perl -w # Uses use strict; use LWP 5.64; # URL my $url = 'http://google.com'; # User Agent Object my $browser = LWP::UserAgent->new; # $browser->proxy(>qw(http ftp), 'http://google.com:80'); $browser->env_proxy; my $response = $browser->get( $url); die "Couldn't get $url -- " ,$response->status_line unless $response->is_success;

Next, have you tried it with both the call to proxy() and env_proxy() commented out? If so, then see this, and then try to figure out what proxy settings your web browser is using (Edit->Preferences->Advanced->Proxies in Mozilla). Obviously, if you can post here using it, then the browser somehow managed to connect to the outside world. Get the host and port number of the proxy used for HTTP (and FTP too, if you want it) and then tell LWP::UserAgent to use that proxy using the proxy() method:

$browser->proxy(http => 'http://proxy.whateverisp.com:8001'); $browser->proxy(ftp => 'http://proxy.whateverisp.com:2101');

Replies are listed 'Best First'.
Re^2: Cannot connect using LWP :behind Proxy
by destined2doom (Initiate) on Dec 29, 2004 at 07:46 UTC
    Hi William, Thank you for the response. I would take care to put da code under  and from future posts.The problem is solved after I set HTTP_Proxy as my environment variable and the same code works now . I would again like to thank you for the quick reply post Regards Shudh

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2022-08-14 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?