Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Checking for an existing URL

by Jenda (Abbot)
on Sep 29, 2002 at 14:57 UTC ( #201549=note: print w/ replies, xml ) Need Help??


in reply to Checking for an existing URL

I thing you should try HEAD instad of GET. If all you want to know is whether the URL is fine, why would you download the whole document? :-)

Another thing. $response->code() returns the HTTP status code. So you do not have to search for anything in the contents. Besides ... it's quite possible that the HTML with the "URL not found" message will NOT contain any 404 at all.

Jenda


Comment on Re: Checking for an existing URL
Download Code
•Re: Re: Checking for an existing URL
by merlyn (Sage) on Sep 29, 2002 at 15:22 UTC
    I thing you should try HEAD instad of GET. If all you want to know is whether the URL is fine, why would you download the whole document? :-)
    Because some servers have been shown to return an error for HEAD, but a real document for GET. So you have to do both. Try HEAD first, but if it fails, retry with GET.

    -- Randal L. Schwartz, Perl hacker

Re: Re: Checking for an existing URL
by PodMaster (Abbot) on Sep 30, 2002 at 06:35 UTC
    It is very rare, but merlyn speaks the truth, some webserver's are broken. There is still no reason to download the whole document. Enjoy the fruits of those who RTFM :) LWP head replacement

    poetry ;)

    update: I don't mean it's rare that merlyn speaks the truth, I mean it is rare that a webserver is broken in such a manner, where a HEAD request would fail like so ;)

    ____________________________________________________
    ** The Third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-09-22 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (178 votes), past polls