<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Is <?php echo $_SERVER['QUERY_STRING'] ?> online?</title>
    <link href="style.css" rel="stylesheet">
    <link href="icon.png" rel="icon">
  </head>
  <body id="about">
    <div class="centercubeplease">
      <h1>Is <?php echo $_SERVER['QUERY_STRING'] ?> online?</h1>
      <h2><?php  function checkOnline($domain) {
        $curlInit = curl_init($domain);
        curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
        curl_setopt($curlInit,CURLOPT_HEADER,true);
        curl_setopt($curlInit,CURLOPT_NOBODY,true);
        curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);

        //get answer
        $response = curl_exec($curlInit);

        curl_close($curlInit);
        if ($response) return true;
        return false;
        }
        if(checkOnline('http://'.$_SERVER['QUERY_STRING'])) {echo "yes"; }
        elseif(gethostbyname($_SERVER['QUERY_STRING']) == $_SERVER['QUERY_STRING']) {echo "That does not exist dummy";}
        else{echo "no";}
      ?></h2>
      <p>Disclamer, this only checks if an http server is reacheable!</p>
     </div>
  </body>
</html>
