There's more than one way to do things | |
PerlMonks |
Get redirected URLby xorl (Deacon) |
on Aug 10, 2009 at 15:29 UTC ( [id://787356]=perlquestion: print w/replies, xml ) | Need Help?? |
xorl has asked for the wisdom of the Perl Monks concerning the following question: So we've redone our website. Now I want to make sure all the redirects are going to the correct place. What I want to do is request the old URL and see if the server gives a 301 code with the correct new url. I found Is it possible to get the redirected URL?, but that didn't seem to have the answer. My script:
Now running the above code, it seems to realize the oldurl is redirected and pulls the new url and then gives me a 200 OK for the status line. I need to figure out how to get the 301 status from the url I gave it and not the new url it seems to pull from. Can someone help me? Thanks in advance. Brief Update: I know the url in question is being redirected b/c of this: Update 2: Trying WWW::Mechanize now. Will post results. Update 3: WWW::Mechanize worked although the redirect_ok[0] solution did not. Here's the relevant code:
Back to
Seekers of Perl Wisdom
|
|