I am still having trouble using the proxy, I thought I'd send my new code in which
I hopefully used your code suggestions correctly. I can ping proxy-web.dri.edu  ,
and I have added this debug line (use LWP::Debug qw(+ -conns);)
so I can see that it is really proxied to proxy-web.dri.edu
any clues ??
------------
New error:
500 (Internal Server Error) Can't connect to proxy-web.dri.edu:80 (Bad hostname
'proxy-web.dri.edu')
Client-Date: Fri, 14 Nov 2003 19:44:18 GMT
------------
heres my new code:


#!/usr/bin/perl -w

use strict;
use URI::URL;
use LWP;   # LWP => Library for World Wide Web access in Perl
use LWP::Debug qw(+ -conns);

require LWP::UserAgent;
                        #proxy-web.dri.edu
my $PROXY_URL = 'http://proxy-web.dri.edu/'; ### Proxy URL or Address + Port
my $PROXY_FTP = 'http://proxy-ftp.dri.edu/';

my $ua = "";
$ua = new LWP::UserAgent;
$ua->proxy(['http', 'ftp'], $PROXY_URL,$PROXY_FTP);


my $n = "";
my $data = "";
my $response = "";

my $errors_page = "proxy_errors.txt";
open (OUT2, "> $errors_page") or die "Can't write to file $errors_page: $!\n";

my $outdir = 'C:\\\\a_perl\\hw10\\sols\\' ;
my $url = url('http://earthquake.usgs.gov/recenteqsUS/Quakes/quakes_all.html/');

my $src = $outdir .'quakes_all.html';


my $req = new HTTP::Request 'GET', $url;
my $res = $ua->request($req);
print OUT2 $res->as_string;

$response = $ua->get($url);

die "Error while getting ", $response->request->uri,
   " -- ", $response->status_line, "\nAborting"
  unless $response->is_success;

open (OUT, "< $src") or die "Can't read file $src: $!\n";
  print "Hi Lori\n";
close OUT;


close OUT2;


"$Bill Luebkert" wrote:

> lorid wrote:
>
> > Any docs or examples on how to use a proxy when using getstore will be
> > greatly appreciated.!
> >
> > I am having trouble getting a html file from the web due to a proxy
> > issue:
> >
> > I found a debugging tool that helps, and I may just need to ask my boss
> > for the right proxy name but I think I have it...
> > anyway here is my simple test case , but first the error msg's I
> > received:
> >
> > 1st error I got that let me know it really is a proxy problem :
> > LWP::UserAgent:: _need_proxy: Not proxid .....
> >
> >
> > So I am guessing I can use the same proxy I use for FTP and tried
> > using this line I got from the UserAgent manpage under LWP
> > :$ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
> >  replacing the line in bold with my ftp proxy from work (which is how
> > I'm connected to the web)
> >
> > Which didnt quite work cuz the error I get now is:
> > Cant call methond proxy on an undefined value at line ....30 (the line
> > entails: my$ua->proxy(['http','ftp'],'http://proxy-ftp.dri.edu/');
> >
> > my test program:
> > #!/usr/bin/perl -w
> >
> > use strict;
> > use LWP::Simple;   # LWP => Library for World Wide Web access in Perl
> > #use LWP::DebugFile;
> >
> > use LWP::Debug qw(+ -conns);
> >
> > my $n = "";
> > my $data = "";
> > my $response = "";
> > print LWP::Debug::conns("read $n bytes: $data");
> >
> > use URI::URL;
> >
> >
> > my $outdir = "C:\\a_perl\\test\\getwebfiles\\" ;
> > my $url =
> > url('http://earthquake.usgs.gov/recenteqsUS/Quakes/quakes_all.html');
> > my $src = $outdir .'quakes_all.html';
> > open (OUT, "< $src") or die "Can't read file $src: $!\n";
> >
> > require LWP::UserAgent;
> > #$ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
> >
> > my $ua->proxy(['http', 'ftp'],'http://proxy-ftp.dri.edu/');
>
> Either use Simple or use an agent.  If you are going to use $ua,
> you need to define it:
>
> use LWP;
> my $ua = new LWP::UserAgent;
> my $ua->proxy(['http', 'ftp'], 'http://proxy-ftp.dri.edu/');
> my $req = new HTTP::Request 'GET', $url;
> my $res = $ua->request($req);
> print $res->as_string;
>
> >  $response = $ua->get($url);
> >  die "Error while getting ", $response->request->uri,
> >    " -- ", $response->status_line, "\nAborting"
> >   unless $response->is_success;
> >
> >
> > close OUT;
>
> --
>   ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
>  (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
>   / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
> -/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to