Solved

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

Posted on 2004-09-17
3
360 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

734 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