in reply to Re: proxy problwm LWP
in thread proxy problwm LWP

hii

but if don't provide encrionment variable and directly using the

 $ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');

then its saying

"Can't call method "proxy" on an undefined value at trial_lwp.pl line 3."

Replies are listed 'Best First'.
Re^3: proxy problwm LWP
by hdb (Monsignor) on May 18, 2015 at 07:21 UTC

    I suggest to use strict; and use warnings; and then have the "proxy" line after the "new" line for the user agent:

    my $ua = LWP::UserAgent->new(); $ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
      hello

      will you see for one more time? its still not working

      now the script is :

      use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); $ua->proxy(['http', 'ftp'], 'http://192.168.64.1:3128/'); my $req = HTTP::Request->new('GET','https://twitter.com/?lang=en'); my $res = $ua->request($req); print $res->status_line;
      and on run shows error message

      500 Can't connect to twitter.com:443 (Bad hostname)

      thanks

        https is not http:

        $ua->proxy(['http', 'ftp'], 'http://192.168.64.1:3128/');
        my $req = HTTP::Request->new('GET','https://twitter.com/?lang=en');