Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: xml/html detection script

by b10m (Vicar)
on Aug 17, 2005 at 13:06 UTC ( #484409=note: print w/replies, xml ) Need Help??


in reply to xml/html detection script

The easiest way, is to do a HEAD on the URL in question and see what the returned headers tell you. So, something like:

use LWP::Simple qw/head/; for('http://perlmonks.org/index.pl?displaytype=xml;node_id=484407', 'http://perlmonks.org/index.pl?node_id=484407') { my ($type, $length, $modified_time, $expires, $server) = head($_); print "File is: $type\n"; }
--
b10m

All code is usually tested, but rarely trusted.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2023-02-09 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (44 votes). Check out past polls.

    Notices?