Thanks Bill! Your code worked great, I tested it on a different url and it worked ! yeah, but it timed out on the page Im trying to get (Im working from home on a 56k modem) but it seems to get other pages just fine. With the debug code I can see that on the ... quakes.all page it zips along and then it hangs. I played with increasing the timeout and it still timesout... must be something in the source code.. but the main thing is now I can use LWP to get files. The purpose in reading this file was to learn how to get a file thru LWP (even through a proxy) to parse it and create new files. Ive got the rest working fine but was stuck on the proxy part... thanks again Lori
"$Bill Luebkert" wrote: > lorid wrote: > > > 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: > > This works (commented out the $ua->proxy lines to test): > > use strict; > use URI::URL; > use LWP; > use LWP::Debug qw(+ -conns); > > my $errors_page = "proxy_errors.txt"; > my $url = url ('http://earthquake.usgs.gov/recenteqsUS/Quakes/quakes_all.html'); > > my $PROXY_URL = 'http://proxy-web.dri.edu/'; ### Proxy URL or Address + Port > my $PROXY_FTP = 'http://proxy-ftp.dri.edu/'; > > my $ua = new LWP::UserAgent; > $ua->proxy(http => $PROXY_URL); > $ua->proxy(ftp => $PROXY_FTP); > > my $req = new HTTP::Request 'GET', $url; > my $res = $ua->request($req); > > open OUT, ">$errors_page" or die "Create $errors_page: $!"; > if ($res->is_success) { > print OUT $res->as_string; > print "Got URL OK\n"; > } else { > print OUT "Error getting $url, ", $res->status_line, "\n"; > print STDERR "Error getting $url, ", $res->status_line, "\n"; > die; > } > close OUT; > > # what's the purpose in reading this file ? > > #my $outdir = 'C:/a_perl/hw10/sols' ; > #my $src = "$outdir/quakes_all.html"; > # open IN, $src or die "Can't read file $src: $!\n"; > print "Hi Lori\n"; > # close IN; > > __END__ > > -- > ,-/- __ _ _ $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