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

UserAgent with ASP

Michael R. Fahey
February 14, 2001 00:05
UserAgent with ASP
Message ID:

The server returns an error when I request the following url using

$url = ' 2';
$request = new HTTP::Request('GET', $url);

I can retrieve the first page with:

	$SEARCH_URL = '';

	use LWP::UserAgent;
	use HTTP::Cookies;

	use CGI;
	$cgi = new CGI;
	$ua = new LWP::UserAgent;

	my $string_head = shift (@ARGV);
	my $file_name = "$string_head.html";

	open (OUT, "> $file_name") or die "Couldn't open $file_name for reading:

	$request = new HTTP::Request('POST', $SEARCH_URL);
#garbage characters here are Chinese (big-5) for 'query'
	$response = $ua->request( $request );

Then I want to get the next five pages, so I tried ...

	$url = '
	$request = new HTTP::Request('GET', $url);      $request->content();
	$response = $ua->request( $request );
	my $file_name = "$string_head2.html";open (OUT, "> $file_name") or die
"Couldn't open 	$file_name for reading: $!\n";
	print OUT $content;
	print "$content\n\n";

But no luck.  Is my url malformed? Does it need to be escaped?  It appears
in the browser as when I
go to the second page manually.

Thanks for any suggestions.

Michael Fahey Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About