@Adrian4net
That's not really true. A domain just points to an IP address. It doesn't necessarily have to have anything to do with a website.
But anyways, to accomplish what you are trying to do
(or at least what I think you are trying to do) you just need to follow a fairly simple process.
Consider this pseudo-code
(PHPseudo-code, if you will :P):
- if( HEAD request was successfull ){
-
if( Status code is 200 ){
-
// Server is online and not redirecting you.
-
}
-
else if( Status code is 300-399 ){
-
$location = Location header
-
// Server is online and redirecting you to $location.
-
}
-
else {
-
// Server is online and not redirecting you,
-
// but the request was not successful.
-
}
-
}
-
else {
-
// Server is offline.
-
}
That could be the skeleton of your script. You just need to fill it in with working code.
You can either do this by using the
get_headers function I mentioned earlier, or by sending the request by some other means.
(Curl, Sockets, etc...)