I have a simple url that has 302 temp. go to another page.
I am trying to get if the URL returns the code 200 (for OK) to restore it, and stop if something other than 200 is returned.
My code is:
my $ua = LWP::UserAgent->new( env_proxy => 1,keep_alive => 1, timeout => 30, agent => "Mozilla/4.76 [en] (Win98; U)"); my $response = $ua->get( $currenturl); print $response->code;
The code above ALWAYS returns 200, even if it is 302. I tested the header response with FireBug in Firefox. The URL returns β302 Moved Temporarilyβ in the Net module in FireBug. But the code above in perl returns 200. Why?
source share