Using UserAgent you requested: $req = HTTP::Request->new(GET => 'http://www.google.com');
while using RobotUA you requested: $req = HTTP::Request->new(GET => 'http://laptop.radnor/dissertation/index.html'); So first off, the two URL's differ. But more importantly the second URL looks malformed as the host is 'laptop.radnor'. Does not look legal to me or if it is legal I'd be surprised if any DNS can resolve it to any IP address. To test, make sure you use a URL that you know works. -- Mike Arms -----Original Message----- From: Tom Freeman [mailto:[EMAIL PROTECTED]] Sent: Friday, January 25, 2002 2:21 PM To: [EMAIL PROTECTED] Subject: LWP::RobotUA Hi, I'm relatively new to Perl, but i'm trying to write a Web Spider as part of the dissertation for my degree. I've discovered the LWP modules and managed to get a very basic UserAgent request for a webpage working just fine, however i've also found the RobotUA module which seems to be even better providing extra functionality, most notably the inclusion of the robots.txt protocol. So i'd like to use RobotUA instead of the basic UserAgent module, but I can't get it to work...! :( (If i've confused terms here I appologise, as I said i'm pretty new at this:) Anyway, in a nutshell can anyone tell me why this works : #!c:\perl\bin\perl use LWP::UserAgent; $ua = new LWP::UserAgent; $req = HTTP::Request->new(GET => 'http://www.google.com'); # send request $res = $ua->request($req); # check the outcome if ($res->is_success) { print $res->content; } else { print "Error: " . $res->status_line . "\n"; } but this doesn't: #!c:\perl\bin\perl use LWP::RobotUA; $ua = new LWP::RobotUA 'my-robot/0.1', '[EMAIL PROTECTED]'; $ua->delay(10); # be very nice, go slowly $req = HTTP::Request->new(GET => 'http://laptop.radnor/dissertation/index.html'); # send request $res = $ua->request($req) or print "Failed to send request: $!"; # check the outcome if ($res->is_success) { print $res->content; } else { print "Error: " . $res->status_line . "\n"; } I don't even get an error message, it just hangs when trying to send the request... Any help or comments would really be appreciated just to get me started with this project, Thanks, Tom Get your FREE download of MSN Explorer at http://explorer.msn.com. _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/activeperl _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/activeperl
