|Just another Perl shrine|
Checking for an existing URLby kidd (Curate)
|on Sep 29, 2002 at 14:02 UTC||Need Help??|
kidd has asked for the
wisdom of the Perl Monks concerning the following question:
Hello monks: Im looking for some ideas in how is the best way to do this.
Im making a script that takes an URL as an input and checks for its existance. The current code I came up with is this:
What I do is that I fetch the URL and then check for either the string "404 Not Found" in the $tring or for it to be empty.
The problem with this approach is that there may be a possibilitie that the page has some text that say "404 Not Found" as part of the content but it actually exists.
So I thought that maybe there will be some kind of headers that tell you what kind of response you got...maybe a 302 or a 501, but I got no idea of how can I achieve this.