0

Recently, I bought a domain kkziomek.eu. The root domain is hosted on a remote hosting. I added a subdomain "komputer.kkziomek.eu" which is hosted on my computer. To do that I created a subdomain, then edited the "A Record" to redirect on my computer IP, where I have a server set up. It works!

Now, my only question is:

I want to make a subdirectory on my root website "kkziomek.eu/komp/index.php" which would say in big letters "ONLINE" when my computer and server on it is turned on, and in big letters "OFFLINE" when my computer, or server on my computer is off.

So in other words, it would say "ONLINE" when "komputer.kkziomek.eu" is available, and "OFFLINE" when "komputer.kkziomek.eu" is not available.

How would I do that?

KKZiomek
  • 103
  • 3

1 Answers1

1

Add below code in "kkziomek.eu/komp/index.php"

<?php
$host = 'komputer.kkziomek.eu';
if($socket =@ fsockopen($host, 80, $errno, $errstr, 30)) {
echo 'ONLINE!';
fclose($socket);
} else {
echo 'OFFLINE.';
}
?>
Mukesh Jagani
  • 237
  • 1
  • 3