code: public static function getHost()
      {
          $host = null;
          if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
              $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
          } elseif (isset($_SERVER['HTTP_HOST'])) {
              $host = $_SERVER['HTTP_HOST'];
          } elseif (isset($_SERVER['SERVER_NAME'])) {
              $host = $_SERVER['SERVER_NAME'];
          } else {
              $host = gethostname();
          }
          return $host;
      }
docs: Get host.
  
  @return string