Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: LWP::Simple to judge the url

by Corion (Patriarch)
on Jun 20, 2011 at 09:18 UTC ( #910530=note: print w/replies, xml ) Need Help??


in reply to LWP::Simple to judge the url

See the ->head method of LWP::UserAgent. The Content-Type header of the response should tell you what content the page sends back.

Replies are listed 'Best First'.
Re^2: LWP::Simple to judge the url
by bart (Canon) on Jun 20, 2011 at 11:34 UTC
    LWP::Simple does head just as well. And it might be simpler to use.
    head($url)
    Get document headers. Returns the following 5 values if successful: ($content_type, $document_length, $modified_time, $expires, $server)

    Returns an empty list if it fails. In scalar context returns TRUE if successful.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2023-12-06 18:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (31 votes). Check out past polls.

    Notices?