Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

How do I check if a file exists on another (remote) domain?

by CMW (Initiate)
on Sep 17, 2001 at 17:32 UTC ( [id://112853]=perlquestion: print w/replies, xml ) Need Help??

CMW has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to create a script which checks if a site is up or down by checking for a certain file on that domain.

I have tried a few things but as it seems they are all for checking local file and to check for a remote file!

Any suggestions?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How do I check if a file exists on another (remote) domain?
by davorg (Chancellor) on Sep 17, 2001 at 17:52 UTC

    Use LWP::Simple and the head function.

    use LWP::Simple; my $url = 'http://some.server.com/file.html'; if (head($url)) { # file is there } else { # file is missing }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-29 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found