mrguy123 has asked for the wisdom of the Perl Monks concerning the following question:
It takes me about 1.5 seconds to get the response code (403). If I can somehow get it faster, it will make a big difference when I am testing 1000s of linksuse strict; use warnings; use LWP::UserAgent; use Time::HiRes; { my $ua = new LWP::UserAgent(); my $search_address = "http://ejournals.ebsco.com/direct.asp?Journa +lID=101503"; my $req = new HTTP::Request ('GET',$search_address); my $start = [ Time::HiRes::gettimeofday( ) ]; ##Get the response object my $res = $ua->request($req); ##Get the response time and return code my $diff = Time::HiRes::tv_interval( $start ); my $code = $res->code(); print "Code $code fetched in $diff seconds\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Fast fetching of HTML response code
by BrowserUk (Patriarch) on May 30, 2012 at 08:42 UTC | |
by mrguy123 (Hermit) on May 30, 2012 at 08:59 UTC | |
by BrowserUk (Patriarch) on May 30, 2012 at 10:16 UTC | |
Re: Fast fetching of HTML response code
by Corion (Patriarch) on May 30, 2012 at 08:47 UTC | |
by mrguy123 (Hermit) on May 30, 2012 at 09:06 UTC | |
by Corion (Patriarch) on May 30, 2012 at 09:09 UTC | |
Re: Fast fetching of HTML response code
by Anonymous Monk on May 30, 2012 at 08:41 UTC |