Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Need to test HTTP page responses

by b10m (Vicar)
on Oct 22, 2008 at 12:21 UTC ( #718721=note: print w/ replies, xml ) Need Help??

in reply to Need to test HTTP page responses

As stated, LWP::UserAgent will be of help here, but make sure to look at the requests_redirectable option if you want to actually see if the URL returns a 300-code. If you leave HEAD and GET as requests_redirectable values, you'll get the results of the codes after the redirection.

use LWP::UserAgent; my $ua = LWP::UserAgent->new( requests_redirectable => [] ); while(<DATA>) { chomp; my $r = $ua->head($_); print $_,": ",$r->code,"\n"; } __DATA__

In this case, the tinyurl URL will return 301. If you leave the request_redirectable option as default, you'll get 200 as status code (coming from, not


Comment on Re: Need to test HTTP page responses
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://718721]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2015-11-30 07:27 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (764 votes), past polls