Solved

How to check if a domain is live even if PING is blocked?

Posted on 2004-09-17
3
322 Views
Last Modified: 2011-04-14
I have been using PING to check if a domain is live, however, some domains, depsite being available on port 80, are blocking PING.

       $response=shell_exec("ping $site -n -c 1 -w 2 -W 2");

I want a fast way of testing port 80, if it is live or not.  This must be an automated solution as it needs to be part of a script.
0
Comment
Question by:vincevincevince
3 Comments
 

Expert Comment

by:philipp999
ID: 12089033
Hi,

would this work? (needs netcat installed):
printf "GET / HTTP/1.0\n\n" | nc -w $timout $host $port | perl -pe 'if(m|^HTTP/1\.1 200 OK|) { print "OK\n"; } else { print "NOPE\n";} exit(1);'

best,

philipp
0
 
LVL 6

Accepted Solution

by:
blkline earned 100 total points
ID: 12090018
Perhaps something like:

wget -q -O /dev/null URL && echo "success"

or

wget -q -O /dev/null URL || echo "failure"

might fit the bill?  

URL can be ftp://  or http:// styles.

wget has quite a number of options from which to choose for timeouts and retries and such.

Barry
0
 
LVL 1

Author Comment

by:vincevincevince
ID: 12091172
Barry, that is just perfect, thanks :-)

You really deserve the points, I wish I had more to give
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now