develooper Front page | perl.libwww | Postings from March 2001

Trouble getting site

Thread Next
From:
John W Cunningham
Date:
March 21, 2001 20:03
Subject:
Trouble getting site
Message ID:
BEEOLIJOIOBCOCILGHKIAELBDBAA.john@pickaprof.com
Hello all,

I'm having trouble pulling a certain site.  Ordinarily this script works
perfectly, but it just doesn't want to retrieve this site.  What am I doing
wrong?

Thanks!
-John

print &WWWget("http://registrar.ucdavis.edu/CSRD/spring2001/(AAS).html");

sub WWWget {

		# Create a user agent object
 		use LWP::UserAgent;
  		$ua = new LWP::UserAgent;
		$ua->agent("Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt" .
$ua->agent);

		#Timeout
		my $timeout = 10000;

		# Create a request
		my $req = new HTTP::Request GET => $_[0];
  		$req->content_type('application/x-www-form-urlencoded');
		$req->content('match=www&errors=0');

		# Pass request to the user agent and get a response back
		my $res = $ua->request($req);

		# Check the outcome of the response
		if ($res->is_success) {

			return($res->content);

			print(".");
		}else{
			print("Mine Error - ",$_[0],"\n");
		}
}


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About