Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Website Connectivity Script

Status
Not open for further replies.

n3tw0rkadm1n1strat0r

IS-IT--Management
Aug 29, 2006
119
US
Does anyone know of a script that will check to see if a website is up? Not a script that will just ping the website, because that just says if the server is up, but the website itself...
 
Ok, so I found this...

Code:
#!C:\Perl\bin\perl.exe

perl -MLWP::Simple -e 'getprint "[URL unfurl="true"]http://www.yahoo.com/"'[/URL]

 use LWP::Simple;
 $content = get("[URL unfurl="true"]http://www.yahoo.com/");[/URL]
 die "Couldn't get it!" unless defined $content;

 if (mirror("[URL unfurl="true"]http://www.yahoo.com/",[/URL] "foo") == RC_NOT_MODIFIED) {
     ...
 }

 if (is_success(getprint("[URL unfurl="true"]http://www.yahoo.com/")))[/URL] {
     ...
 }

But nothing happens when I run it...
 
Here is the syntax errors I saw when running form the command line:

syntax error at C:\Documents and Settings\ekrengel\Desktop\PerlWebsiteCheck.pl l
ine 3, near "MLWP::Simple -e "
"use" not allowed in expression at C:\Documents and Settings\ekrengel\Desktop\Pe
rlWebsiteCheck.pl line 5, near ""
syntax error at C:\Documents and Settings\ekrengel\Desktop\PerlWebsiteCheck.pl l
ine 10, near "..."
Execution of C:\Documents and Settings\ekrengel\Desktop\PerlWebsiteCheck.pl abor
ted due to compilation errors.
 
Good deal.

Yes, this script simply uses LWP::UserAgent. Which is the more advanced module in the LWP package.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top