Executing the code use LWP::UserAgent; $ua = LWP::UserAgent->new; $req1 = HTTP::Request->new(GET => 'http://mickey/htdocs-test/tony.txt'); $resp1 = $ua->request($req1); print "response code = ", $resp1->code, "\n"; print "response message = ", $resp1->message, "\n"; print "response base = ", $resp1->base, "\n"; print $resp1->as_string;
I receive the output response code = 200 response message = OK response base = http://mickey/htdocs-test/tony.txt Hi, Tony This is a test for LWP. Bye (excluding the headers), which looks fine. However, when I change to the code use LWP::UserAgent; $ua = LWP::UserAgent->new; $req1 = HTTP::Request->new(GET => 'http://mickey/htdocs-test/tony.*'); $resp1 = $ua->request($req1); print "response code = ", $resp1->code, "\n"; print "response message = ", $resp1->message, "\n"; print "response base = ", $resp1->base, "\n"; print $resp1->as_string; I get the following error output (excluding the headers): response code = 404 response message = Not Found response base = http://mickey/htdocs-test/tony.* <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>404 Not Found</TITLE> </HEAD><BODY> <H1>Not Found</H1> The requested URL /htdocs-test/tony.* was not found on this server.<P> <HR> <ADDRESS>Apache/1.3.19 Server at localhost Port 80</ADDRESS> </BODY></HTML> Is wildcarding not allowed or am I going about this the wrong way? The ultimate goal here is to save all remote files matching a given wildcard locally under the same names as they had remotely? In other words...suppose there is a website http://www.junkABC.com that has files named junk1.20030819, junk2.20030819, and junk4.20030819 that I need to pick up using the wildcard junk*.20030819. Is there a nice, concise way to transfer these files without having to first go out and get a directory listing, figure out which file names in the listing match the wildcard, and then transfer them one by one. Thanks.